static void build_search_entry(GitgWindow *window, GtkBuilder *builder) { GtkWidget *box = GTK_WIDGET(gtk_builder_get_object(builder, "hbox_top")); GtkWidget *entry = sexy_icon_entry_new(); GtkImage *image = GTK_IMAGE(gtk_image_new_from_stock(GTK_STOCK_FIND, GTK_ICON_SIZE_MENU)); sexy_icon_entry_set_icon(SEXY_ICON_ENTRY(entry), SEXY_ICON_ENTRY_PRIMARY, image); gtk_tree_view_set_search_entry(window->priv->tree_view, GTK_ENTRY(entry)); gtk_widget_show(entry); gtk_box_pack_end(GTK_BOX(box), entry, FALSE, FALSE, 0); GtkBuilder *b = gitg_utils_new_builder( "gitg-menus.xml"); GtkUIManager *manager = GTK_UI_MANAGER(gtk_builder_get_object(b, "uiman")); window->priv->search_popup = GTK_WIDGET(g_object_ref(gtk_ui_manager_get_widget(manager, "/ui/search_popup"))); gtk_builder_connect_signals(b, window); g_object_unref(b); g_signal_connect(entry, "icon-pressed", G_CALLBACK(on_search_icon_pressed), window); gtk_tree_view_set_search_column(window->priv->tree_view, 1); gtk_tree_view_set_search_equal_func(window->priv->tree_view, search_equal_func, window, NULL); GtkAccelGroup *group = gtk_accel_group_new(); GClosure *closure = g_cclosure_new(G_CALLBACK(focus_search), entry, NULL); gtk_accel_group_connect(group, GDK_f, GDK_CONTROL_MASK, 0, closure); gtk_window_add_accel_group(GTK_WINDOW(window), group); }
GtkWidget *nsgtk_entry_new(void) { #if GTK_CHECK_VERSION(2,16,0) return gtk_entry_new(); #else return GTK_WIDGET(sexy_icon_entry_new()); #endif }