int makeWindow(RuskWindow *rusk) { GtkWidget *box; if((rusk->window = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL))) == NULL) { return -1; } gtk_container_set_border_width(GTK_CONTAINER(rusk->window), BORDER_WIDTH); gtk_widget_override_background_color(GTK_WIDGET(rusk->window), GTK_STATE_FLAG_NORMAL, BORDER_COLOR_NORMAL); box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_container_add(GTK_CONTAINER(rusk->window), box); rusk->addressbar = GTK_ENTRY(gtk_entry_new()); gtk_entry_set_placeholder_text(rusk->addressbar, "URI"); gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(rusk->addressbar), FALSE, FALSE, 0); rusk->globalSearch = GTK_ENTRY(gtk_search_entry_new()); gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(rusk->globalSearch), FALSE, FALSE, 0); rusk->insiteSearch = GTK_ENTRY(gtk_search_entry_new()); gtk_entry_set_placeholder_text(rusk->insiteSearch, "site search"); gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(rusk->insiteSearch), FALSE, FALSE, 0); rusk->progressbar = GTK_PROGRESS_BAR(gtk_progress_bar_new()); gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(rusk->progressbar), FALSE, FALSE, 0); rusk->webview = WEBKIT_WEB_VIEW(webkit_web_view_new_with_context(webkit_web_context_new_with_website_data_manager(webkit_website_data_manager_new( "base-cache-directory", g_strdup_printf("%s/rusk", g_get_user_cache_dir()), "disk-cache-directory", g_strdup_printf("%s/rusk", g_get_user_cache_dir()), "base-data-directory", g_strdup_printf("%s/rusk/data", g_get_user_data_dir()), "indexeddb-directory", g_strdup_printf("%s/rusk/indexed", g_get_user_data_dir()), "local-storage-directory", g_strdup_printf("%s/rusk/local-storage", g_get_user_data_dir()), "offline-application-cache-directory", g_strdup_printf("%s/rusk/offline-apps", g_get_user_data_dir()), "websql-directory", g_strdup_printf("%s/rusk/websql", g_get_user_data_dir()), NULL )))); gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(rusk->webview), TRUE, TRUE, 0); g_signal_connect(G_OBJECT(rusk->window), "destroy", G_CALLBACK(closeRusk), rusk); gtk_widget_show_all(GTK_WIDGET(rusk->window)); gtk_widget_set_visible(GTK_WIDGET(rusk->addressbar), FALSE); gtk_widget_set_visible(GTK_WIDGET(rusk->globalSearch), FALSE); gtk_widget_set_visible(GTK_WIDGET(rusk->progressbar), FALSE); gtk_widget_set_visible(GTK_WIDGET(rusk->insiteSearch), FALSE); g_signal_connect(G_OBJECT(rusk->window), "key-press-event", G_CALLBACK(onKeyPress), rusk); g_signal_connect(G_OBJECT(rusk->insiteSearch), "search-changed", G_CALLBACK(onInSiteSearchInput), rusk); g_signal_connect(G_OBJECT(rusk->addressbar), "key-release-event", G_CALLBACK(onAddressbarInput), rusk); g_signal_connect(G_OBJECT(rusk->globalSearch), "activate", G_CALLBACK(onGlobalSearchActivate), rusk); return 0; }
void search_box(CSIde_app *app){ SearchBox *search =(SearchBox*) g_slice_new(SearchBox); GtkWidget *search_dialog, *area, *grid, *btn_find, *btn_replace, *btn_replace_all; search_dialog = gtk_dialog_new_with_buttons ("search box", GTK_WINDOW(app->main_window), GTK_DIALOG_DESTROY_WITH_PARENT, "Close", GTK_RESPONSE_CANCEL, NULL); search->find_entry = gtk_search_entry_new(); search->replace_entry = gtk_entry_new(); search->app = app; btn_find = gtk_button_new_with_label("Find"); g_signal_connect(btn_find,"clicked",G_CALLBACK(search_btn_clicked),(gpointer) search); btn_replace = gtk_button_new_with_label("Replace"); g_signal_connect(btn_replace,"clicked",G_CALLBACK(replace_btn_clicked),(gpointer) search); btn_replace_all = gtk_button_new_with_label("Replace all"); g_signal_connect(btn_replace_all,"clicked",G_CALLBACK(replace_all_btn_clicked),(gpointer) search); area = gtk_dialog_get_content_area(GTK_DIALOG(search_dialog)); gtk_container_set_border_width(GTK_CONTAINER(area),10); grid = gtk_grid_new(); gtk_container_set_focus_child (GTK_CONTAINER(grid),search->find_entry); //gtk_grid_set_row_homogeneous(GTK_GRID(grid),TRUE); gtk_grid_set_column_homogeneous(GTK_GRID(grid),TRUE); gtk_grid_set_row_spacing (GTK_GRID(grid),10); gtk_grid_set_column_spacing (GTK_GRID(grid),10); gtk_box_pack_start (GTK_BOX(area),grid,TRUE,TRUE,0); gtk_grid_attach (GTK_GRID(grid),btn_find,1,1,5,1); gtk_grid_attach (GTK_GRID(grid),search->find_entry,6,1,6,1); gtk_grid_attach (GTK_GRID(grid),btn_replace,1,3,5,1); gtk_grid_attach (GTK_GRID(grid),search->replace_entry,6,3,6,1); gtk_grid_attach (GTK_GRID(grid),btn_replace_all,1,5,5,1); gtk_widget_show_all(grid); gtk_text_buffer_get_start_iter(GTK_TEXT_BUFFER(search->app->editor->buffer),&iStart); switch(gtk_dialog_run(GTK_DIALOG(search_dialog))){ case GTK_RESPONSE_CANCEL : gtk_widget_destroy(search_dialog); g_slice_free(SearchBox,search); break; } }
virtual attached_t create_detached() const { attached_t detached = 0; GNOMA_LOG_MESSAGE_DEBUG("gtk_search_entry_new()..."); if ((detached = gtk_search_entry_new())) { GNOMA_LOG_MESSAGE_DEBUG("..." << gpointer_to_string(detached) << " = gtk_search_entry_new()"); } else { GNOMA_LOG_ERROR("...failed 0 = gtk_search_entry_new()"); } return detached; }
GtkWidget * do_search_entry2 (GtkWidget *do_widget) { GtkWidget *vbox; GtkWidget *hbox; GtkWidget *label; GtkWidget *entry; GtkWidget *container; GtkWidget *searchbar; GtkWidget *button; if (!window) { window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (window), "Delayed Search Entry"); gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget)); gtk_window_set_resizable (GTK_WINDOW (window), TRUE); gtk_widget_set_size_request (window, 200, -1); g_signal_connect (window, "destroy", G_CALLBACK (search_entry_destroyed), &window); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_container_add (GTK_CONTAINER (window), vbox); gtk_container_set_border_width (GTK_CONTAINER (vbox), 0); entry = gtk_search_entry_new (); container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); gtk_widget_set_halign (container, GTK_ALIGN_CENTER); gtk_box_pack_start (GTK_BOX (container), entry, FALSE, FALSE, 0); searchbar = gtk_search_bar_new (); gtk_search_bar_connect_entry (GTK_SEARCH_BAR (searchbar), GTK_ENTRY (entry)); gtk_search_bar_set_show_close_button (GTK_SEARCH_BAR (searchbar), FALSE); gtk_container_add (GTK_CONTAINER (searchbar), container); gtk_box_pack_start (GTK_BOX (vbox), searchbar, FALSE, FALSE, 0); /* Hook the search bar to key presses */ g_signal_connect (window, "key-press-event", G_CALLBACK (window_key_press_event_cb), searchbar); /* Help */ label = gtk_label_new ("Start Typing to search"); gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0); /* Toggle button */ button = gtk_toggle_button_new_with_label ("Search"); g_object_bind_property (button, "active", searchbar, "search-mode-enabled", G_BINDING_BIDIRECTIONAL); gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0); /* Result */ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER (hbox), 0); label = gtk_label_new ("Result:"); gtk_label_set_xalign (GTK_LABEL (label), 0.0); gtk_widget_set_margin_start (label, 6); gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0); label = gtk_label_new (""); gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0); g_signal_connect (entry, "search-changed", G_CALLBACK (search_changed_cb), label); g_signal_connect (entry, "changed", G_CALLBACK (changed_cb), label); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER (hbox), 0); label = gtk_label_new ("Signal:"); gtk_label_set_xalign (GTK_LABEL (label), 0.0); gtk_widget_set_margin_start (label, 6); gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0); label = gtk_label_new (""); gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0); g_signal_connect (entry, "search-changed", G_CALLBACK (search_changed), label); g_signal_connect (entry, "next-match", G_CALLBACK (next_match), label); g_signal_connect (entry, "previous-match", G_CALLBACK (previous_match), label); g_signal_connect (entry, "stop-search", G_CALLBACK (stop_search), label); } if (!gtk_widget_get_visible (window)) gtk_widget_show_all (window); else { gtk_widget_destroy (window); window = NULL; } return window; }
static void gtk_shortcuts_window_init (GtkShortcutsWindow *self) { GtkShortcutsWindowPrivate *priv = gtk_shortcuts_window_get_instance_private (self); GtkToggleButton *search_button; GtkBox *menu_box; GtkBox *box; GtkArrow *arrow; GtkWidget *scroller; GtkWidget *label; GtkWidget *empty; PangoAttrList *attributes; gtk_window_set_resizable (GTK_WINDOW (self), FALSE); gtk_window_set_type_hint (GTK_WINDOW (self), GDK_WINDOW_TYPE_HINT_DIALOG); g_signal_connect (self, "key-press-event", G_CALLBACK (window_key_press_event_cb), NULL); priv->keywords = g_hash_table_new_full (NULL, NULL, NULL, g_free); priv->search_items_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); priv->search_text_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); priv->search_image_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); priv->header_bar = g_object_new (GTK_TYPE_HEADER_BAR, "show-close-button", TRUE, "visible", TRUE, NULL); gtk_window_set_titlebar (GTK_WINDOW (self), GTK_WIDGET (priv->header_bar)); search_button = g_object_new (GTK_TYPE_TOGGLE_BUTTON, "child", g_object_new (GTK_TYPE_IMAGE, "visible", TRUE, "icon-name", "edit-find-symbolic", NULL), "visible", TRUE, NULL); gtk_container_add (GTK_CONTAINER (priv->header_bar), GTK_WIDGET (search_button)); priv->main_box = g_object_new (GTK_TYPE_BOX, "orientation", GTK_ORIENTATION_VERTICAL, "visible", TRUE, NULL); GTK_CONTAINER_CLASS (gtk_shortcuts_window_parent_class)->add (GTK_CONTAINER (self), GTK_WIDGET (priv->main_box)); priv->search_bar = g_object_new (GTK_TYPE_SEARCH_BAR, "visible", TRUE, NULL); g_object_bind_property (priv->search_bar, "search-mode-enabled", search_button, "active", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); gtk_container_add (GTK_CONTAINER (priv->main_box), GTK_WIDGET (priv->search_bar)); priv->stack = g_object_new (GTK_TYPE_STACK, "expand", TRUE, "homogeneous", TRUE, "transition-type", GTK_STACK_TRANSITION_TYPE_CROSSFADE, "visible", TRUE, NULL); gtk_container_add (GTK_CONTAINER (priv->main_box), GTK_WIDGET (priv->stack)); priv->title_stack = g_object_new (GTK_TYPE_STACK, "visible", TRUE, NULL); gtk_header_bar_set_custom_title (priv->header_bar, GTK_WIDGET (priv->title_stack)); label = gtk_label_new (_("Shortcuts")); gtk_widget_show (label); gtk_style_context_add_class (gtk_widget_get_style_context (label), GTK_STYLE_CLASS_TITLE); gtk_stack_add_named (priv->title_stack, label, "title"); label = gtk_label_new (_("Search Results")); gtk_widget_show (label); gtk_style_context_add_class (gtk_widget_get_style_context (label), GTK_STYLE_CLASS_TITLE); gtk_stack_add_named (priv->title_stack, label, "search"); priv->menu_button = g_object_new (GTK_TYPE_MENU_BUTTON, "focus-on-click", FALSE, "visible", TRUE, "relief", GTK_RELIEF_NONE, NULL); gtk_stack_add_named (priv->title_stack, GTK_WIDGET (priv->menu_button), "sections"); menu_box = g_object_new (GTK_TYPE_BOX, "orientation", GTK_ORIENTATION_HORIZONTAL, "spacing", 6, "visible", TRUE, NULL); gtk_container_add (GTK_CONTAINER (priv->menu_button), GTK_WIDGET (menu_box)); priv->menu_label = g_object_new (GTK_TYPE_LABEL, "visible", TRUE, NULL); gtk_container_add (GTK_CONTAINER (menu_box), GTK_WIDGET (priv->menu_label)); G_GNUC_BEGIN_IGNORE_DEPRECATIONS; arrow = g_object_new (GTK_TYPE_ARROW, "arrow-type", GTK_ARROW_DOWN, "visible", TRUE, NULL); gtk_container_add (GTK_CONTAINER (menu_box), GTK_WIDGET (arrow)); G_GNUC_END_IGNORE_DEPRECATIONS; priv->popover = g_object_new (GTK_TYPE_POPOVER, "border-width", 6, "relative-to", priv->menu_button, "position", GTK_POS_BOTTOM, NULL); gtk_menu_button_set_popover (priv->menu_button, GTK_WIDGET (priv->popover)); priv->list_box = g_object_new (GTK_TYPE_LIST_BOX, "selection-mode", GTK_SELECTION_NONE, "visible", TRUE, NULL); g_signal_connect_object (priv->list_box, "row-activated", G_CALLBACK (gtk_shortcuts_window__list_box__row_activated), self, G_CONNECT_SWAPPED); gtk_container_add (GTK_CONTAINER (priv->popover), GTK_WIDGET (priv->list_box)); priv->search_entry = GTK_SEARCH_ENTRY (gtk_search_entry_new ()); gtk_widget_show (GTK_WIDGET (priv->search_entry)); gtk_container_add (GTK_CONTAINER (priv->search_bar), GTK_WIDGET (priv->search_entry)); g_object_set (priv->search_entry, "placeholder-text", _("Search Shortcuts"), "width-chars", 40, NULL); g_signal_connect_object (priv->search_entry, "search-changed", G_CALLBACK (gtk_shortcuts_window__entry__changed), self, G_CONNECT_SWAPPED); g_signal_connect_object (priv->search_bar, "notify::search-mode-enabled", G_CALLBACK (gtk_shortcuts_window__search_mode__changed), self, G_CONNECT_SWAPPED); scroller = g_object_new (GTK_TYPE_SCROLLED_WINDOW, "visible", TRUE, NULL); box = g_object_new (GTK_TYPE_BOX, "border-width", 24, "halign", GTK_ALIGN_CENTER, "spacing", 24, "orientation", GTK_ORIENTATION_VERTICAL, "visible", TRUE, NULL); gtk_container_add (GTK_CONTAINER (scroller), GTK_WIDGET (box)); gtk_stack_add_named (priv->stack, scroller, "internal-search"); priv->search_shortcuts = g_object_new (GTK_TYPE_BOX, "halign", GTK_ALIGN_CENTER, "spacing", 6, "orientation", GTK_ORIENTATION_VERTICAL, "visible", TRUE, NULL); gtk_container_add (GTK_CONTAINER (box), GTK_WIDGET (priv->search_shortcuts)); priv->search_gestures = g_object_new (GTK_TYPE_BOX, "halign", GTK_ALIGN_CENTER, "spacing", 6, "orientation", GTK_ORIENTATION_VERTICAL, "visible", TRUE, NULL); gtk_container_add (GTK_CONTAINER (box), GTK_WIDGET (priv->search_gestures)); empty = g_object_new (GTK_TYPE_GRID, "visible", TRUE, "row-spacing", 12, "margin", 12, "hexpand", TRUE, "vexpand", TRUE, "halign", GTK_ALIGN_CENTER, "valign", GTK_ALIGN_CENTER, NULL); gtk_style_context_add_class (gtk_widget_get_style_context (empty), GTK_STYLE_CLASS_DIM_LABEL); gtk_grid_attach (GTK_GRID (empty), g_object_new (GTK_TYPE_IMAGE, "visible", TRUE, "icon-name", "edit-find-symbolic", "pixel-size", 72, NULL), 0, 0, 1, 1); attributes = pango_attr_list_new (); pango_attr_list_insert (attributes, pango_attr_weight_new (PANGO_WEIGHT_BOLD)); pango_attr_list_insert (attributes, pango_attr_scale_new (1.44)); label = g_object_new (GTK_TYPE_LABEL, "visible", TRUE, "label", _("No Results Found"), "attributes", attributes, NULL); pango_attr_list_unref (attributes); gtk_grid_attach (GTK_GRID (empty), label, 0, 1, 1, 1); label = g_object_new (GTK_TYPE_LABEL, "visible", TRUE, "label", _("Try a different search"), NULL); gtk_grid_attach (GTK_GRID (empty), label, 0, 2, 1, 1); gtk_stack_add_named (priv->stack, empty, "no-search-results"); g_signal_connect_object (priv->stack, "notify::visible-child", G_CALLBACK (update_title_stack), self, G_CONNECT_SWAPPED); }
static void logview_findbar_init (LogviewFindbar *findbar) { GtkWidget *w, *box, *buttons, *images; GtkToolbar *gtoolbar; GtkToolItem *item; LogviewFindbarPrivate *priv; priv = findbar->priv = GET_PRIVATE (findbar); gtoolbar = GTK_TOOLBAR (findbar); gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (findbar)), GTK_STYLE_CLASS_PRIMARY_TOOLBAR); gtk_toolbar_set_style (gtoolbar, GTK_TOOLBAR_BOTH_HORIZ); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_widget_set_halign (box, GTK_ALIGN_CENTER); priv->entry = gtk_search_entry_new (); gtk_widget_set_size_request (priv->entry, 500, -1); gtk_container_add (GTK_CONTAINER (box), priv->entry); buttons = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_style_context_add_class (gtk_widget_get_style_context (buttons), "linked"); gtk_style_context_add_class (gtk_widget_get_style_context (buttons), "raised"); gtk_container_add (GTK_CONTAINER (box), buttons); /* "Previous" and "Next" buttons */ priv->back_button = gtk_button_new (); images = gtk_image_new_from_icon_name ("go-up-symbolic", GTK_ICON_SIZE_MENU); gtk_button_set_image (GTK_BUTTON (priv->back_button), images); gtk_widget_set_valign (priv->back_button, GTK_ALIGN_CENTER); gtk_style_context_add_class (gtk_widget_get_style_context (priv->back_button), "image-button"); gtk_widget_set_tooltip_text (priv->back_button, _("Find previous occurrence of the search string")); gtk_container_add (GTK_CONTAINER (buttons), priv->back_button); priv->forward_button = gtk_button_new (); images = gtk_image_new_from_icon_name ("go-down-symbolic", GTK_ICON_SIZE_MENU); gtk_button_set_image (GTK_BUTTON (priv->forward_button), images); gtk_widget_set_valign (priv->forward_button, GTK_ALIGN_CENTER); gtk_style_context_add_class (gtk_widget_get_style_context (priv->forward_button), "image-button"); gtk_widget_set_tooltip_text (priv->forward_button, _("Find next occurrence of the search string")); gtk_container_add (GTK_CONTAINER (buttons), priv->forward_button); item = gtk_tool_item_new (); gtk_tool_item_set_expand (item, TRUE); gtk_container_add (GTK_CONTAINER (item), box); gtk_toolbar_insert (gtoolbar, item, -1); gtk_widget_show_all (GTK_WIDGET (item)); priv->string = NULL; /* signal handlers */ g_signal_connect (priv->back_button, "clicked", G_CALLBACK (back_button_clicked_cb), findbar); g_signal_connect (priv->forward_button, "clicked", G_CALLBACK (forward_button_clicked_cb), findbar); g_signal_connect (priv->entry, "activate", G_CALLBACK (entry_activate_cb), findbar); g_signal_connect (priv->entry, "changed", G_CALLBACK (entry_changed_cb), findbar); g_signal_connect (priv->entry, "key-press-event", G_CALLBACK (entry_key_press_event_cb), findbar); }
GtkWidget * do_search_entry (GtkWidget *do_widget) { GtkWidget *vbox; GtkWidget *hbox; GtkWidget *label; GtkWidget *entry; GtkWidget *find_button; GtkWidget *cancel_button; if (!window) { window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_screen (GTK_WINDOW (window), gtk_widget_get_screen (do_widget)); gtk_window_set_title (GTK_WINDOW (window), "Search Entry"); gtk_window_set_resizable (GTK_WINDOW (window), FALSE); g_signal_connect (window, "destroy", G_CALLBACK (search_entry_destroyed), &window); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5); gtk_container_add (GTK_CONTAINER (window), vbox); gtk_container_set_border_width (GTK_CONTAINER (vbox), 5); label = gtk_label_new (NULL); gtk_label_set_markup (GTK_LABEL (label), "Search entry demo"); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER (hbox), 0); /* Create our entry */ entry = gtk_search_entry_new (); gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0); /* Create the find and cancel buttons */ notebook = gtk_notebook_new (); gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE); gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE); gtk_box_pack_start (GTK_BOX (hbox), notebook, FALSE, FALSE, 0); find_button = gtk_button_new_with_label ("Find"); g_signal_connect (find_button, "clicked", G_CALLBACK (start_search), entry); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), find_button, NULL); gtk_widget_show (find_button); cancel_button = gtk_button_new_with_label ("Cancel"); g_signal_connect (cancel_button, "clicked", G_CALLBACK (stop_search), NULL); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), cancel_button, NULL); gtk_widget_show (cancel_button); /* Set up the search icon */ search_by_name (NULL, GTK_ENTRY (entry)); /* Set up the clear icon */ g_signal_connect (entry, "icon-press", G_CALLBACK (icon_press_cb), NULL); g_signal_connect (entry, "activate", G_CALLBACK (activate_cb), NULL); /* Create the menu */ menu = create_search_menu (entry); gtk_menu_attach_to_widget (GTK_MENU (menu), entry, NULL); /* add accessible alternatives for icon functionality */ g_object_set (entry, "populate-all", TRUE, NULL); g_signal_connect (entry, "populate-popup", G_CALLBACK (entry_populate_popup), NULL); } if (!gtk_widget_get_visible (window)) gtk_widget_show_all (window); else { gtk_widget_destroy (menu); gtk_widget_destroy (window); } return window; }
static VALUE rg_initialize(VALUE self) { RBGTK_INITIALIZE(self, gtk_search_entry_new()); return Qnil; }