]> git.tdb.fi Git - ext/subsurface.git/blobdiff - gtk-gui.c
Two test dives I added a couple of months ago
[ext/subsurface.git] / gtk-gui.c
index f95ff88cebcccc38ed152799c9150ae8e5a300ab..dce537232fdbd9ba81ca5dfb69b332f28d269228 100644 (file)
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -202,17 +202,25 @@ static void quit(GtkWidget *w, gpointer data)
 }
 
 GtkTreeViewColumn *tree_view_column(GtkWidget *tree_view, int index, const char *title,
-                               data_func_t data_func, PangoAlignment align, gboolean visible)
+                               data_func_t data_func, unsigned int flags)
 {
        GtkCellRenderer *renderer;
        GtkTreeViewColumn *col;
        double xalign = 0.0; /* left as default */
+       PangoAlignment align;
+       gboolean visible;
+
+       align = (flags & ALIGN_LEFT) ? PANGO_ALIGN_LEFT :
+               (flags & ALIGN_RIGHT) ? PANGO_ALIGN_RIGHT :
+               PANGO_ALIGN_CENTER;
+       visible = !(flags & INVISIBLE);
 
        renderer = gtk_cell_renderer_text_new();
        col = gtk_tree_view_column_new();
 
        gtk_tree_view_column_set_title(col, title);
-       gtk_tree_view_column_set_sort_column_id(col, index);
+       if (!(flags & UNSORTABLE))
+               gtk_tree_view_column_set_sort_column_id(col, index);
        gtk_tree_view_column_set_resizable(col, TRUE);
        gtk_tree_view_column_pack_start(col, renderer, TRUE);
        if (data_func)
@@ -578,10 +586,10 @@ static GtkActionEntry menu_items[] = {
        { "SelectEvents",   NULL, "SelectEvents", NULL, NULL, G_CALLBACK(selectevents_dialog) },
        { "Quit",           GTK_STOCK_QUIT, NULL,   "<control>Q", NULL, G_CALLBACK(quit) },
        { "About",          GTK_STOCK_ABOUT, NULL,  NULL, NULL, G_CALLBACK(about_dialog) },
-       { "ViewList",       NULL, "List",  "F1", NULL, G_CALLBACK(view_list) },
-       { "ViewProfile",    NULL, "Profile", "F2", NULL, G_CALLBACK(view_profile) },
-       { "ViewInfo",       NULL, "Info", "F3", NULL, G_CALLBACK(view_info) },
-       { "ViewThree",       NULL, "Three", "F4", NULL, G_CALLBACK(view_three) },
+       { "ViewList",       NULL, "List",  "<control>1", NULL, G_CALLBACK(view_list) },
+       { "ViewProfile",    NULL, "Profile", "<control>2", NULL, G_CALLBACK(view_profile) },
+       { "ViewInfo",       NULL, "Info", "<control>3", NULL, G_CALLBACK(view_info) },
+       { "ViewThree",       NULL, "Three", "<control>4", NULL, G_CALLBACK(view_three) },
 };
 static gint nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]);