+ GtkWidget *window, *themeView, *popup, *item;
+ GtkWidget *vBox = NULL;
+ GtkActionGroup *actionGroup;
+ GtkTreeViewColumn *col;
+ GtkTreeSelection *sel;
+
+ gtk_init (&argc, &argv);
+ g_thread_init( NULL );
+
+ // define main layout : container, menubar, toolbar, themeView
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ gtk_window_set_title(GTK_WINDOW(window), _("Tint2 theme"));
+ gtk_window_set_default_size(GTK_WINDOW(window), 600, 350);
+ g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (menuQuit), NULL);
+ vBox = gtk_vbox_new (FALSE, 0);
+ gtk_container_add (GTK_CONTAINER(window), vBox);
+
+ actionGroup = gtk_action_group_new ("menuActionGroup");
+ gtk_action_group_add_actions (actionGroup, entries, G_N_ELEMENTS (entries), NULL);
+ myUIManager = gtk_ui_manager_new();
+ gtk_ui_manager_insert_action_group (myUIManager, actionGroup, 0);
+ gtk_ui_manager_add_ui_from_string ( myUIManager, fallback_ui_file, -1, NULL );
+ g_signal_connect(myUIManager, "add_widget", G_CALLBACK (menuAddWidget), vBox);
+ gtk_ui_manager_ensure_update(myUIManager);
+
+ themeView = gtk_tree_view_new();
+ gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(themeView), FALSE);
+ gtk_tree_view_set_fixed_height_mode(GTK_TREE_VIEW(themeView), TRUE);
+ col = GTK_TREE_VIEW_COLUMN (g_object_new (GTK_TYPE_TREE_VIEW_COLUMN, "title", _("Theme"), "resizable", TRUE, "sizing", GTK_TREE_VIEW_COLUMN_FIXED, NULL));
+ sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(themeView));
+ gtk_tree_selection_set_mode(GTK_TREE_SELECTION(sel), GTK_SELECTION_SINGLE);
+ gtk_box_pack_start(GTK_BOX(vBox), themeView, TRUE, TRUE, 0);
+ gtk_widget_show(themeView);
+ g_signal_connect(themeView, "popup-menu", G_CALLBACK(onPopupMenu), NULL);
+ g_signal_connect(themeView, "row-activated", G_CALLBACK(viewRowActivated), NULL);
+ //g_signal_connect(themeView, "button-press-event", G_CALLBACK(onViewButtonPressed), (void *)onViewButtonPressed);
+ //g_signal_connect(themeView, "button-release-event", G_CALLBACK(onViewButtonReleased), NULL);
+
+ // popup menu
+ // all you need to do is add the GDK_BUTTON_PRESS_MASK to the window's events
+ gtk_widget_add_events(window, GDK_BUTTON_PRESS_MASK);
+ popup = gtk_menu_new();
+ item = gtk_menu_item_new_with_label("victory");
+ gtk_menu_shell_append(GTK_MENU_SHELL(popup), item);
+ gtk_menu_attach_to_widget(GTK_MENU(popup), window, NULL);
+ gtk_widget_show_all(popup);
+ g_signal_connect(G_OBJECT(window),"button-press-event", G_CALLBACK(viewPopup), (gpointer)popup);
+
+ // load themes
+ loadDir();
+
+ // rig up idle/thread routines
+ //Glib::Thread::create(sigc::mem_fun(window.view, &Thumbview::load_cache_images), true);
+ //Glib::Thread::create(sigc::mem_fun(window.view, &Thumbview::create_cache_images), true);
+
+ gtk_widget_show_all(window);
+ gtk_main ();
+ return 0;
+}
+
+
+static void menuAddWidget (GtkUIManager * p_uiManager, GtkWidget * p_widget, GtkContainer * p_box)
+{
+ gtk_box_pack_start(GTK_BOX(p_box), p_widget, FALSE, FALSE, 0);
+ gtk_widget_show(p_widget);
+}
+
+
+static void viewPopup(GtkWidget *wid, GdkEventButton *event, GtkWidget *menu)
+{
+ if((event->button == 3) && (event->type == GDK_BUTTON_PRESS)) {
+ gtk_menu_popup(GTK_MENU(menu),NULL,NULL,NULL,NULL,event->button,event->time);
+ }
+}
+