]> git.tdb.fi Git - ext/subsurface.git/commitdiff
Add shorthand actions for showing just one of the panes
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 6 Dec 2011 21:00:01 +0000 (13:00 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 6 Dec 2011 21:00:01 +0000 (13:00 -0800)
Currently just tied to F1-F4 (for divelist, profile, info, and "all
three" respectively), which is just crazy.  But using "ctrl-P" for
"Profile" isn't sane either, that's the standard printer keyboard
shortcut.  So what would be good keyboard shortcuts for these things?

I also wonder how I can get gtk to shut up about the fact that a pane
becomes too small for the contents of that pane? We very much want to do
that, and it's very intentional.  Gtk does the right thing apart from
the whining (and apart from the visually ugly part of a widget that
doesn't fit, but making it pretty doesn't really seem possible).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
gtk-gui.c

index 3450a59750161e375ac2b62614d43cbdec7ed6b4..f95ff88cebcccc38ed152799c9150ae8e5a300ab 100644 (file)
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -19,6 +19,7 @@ GtkWidget *main_window;
 GtkWidget *main_vbox;
 GtkWidget *error_info_bar;
 GtkWidget *error_label;
+GtkWidget *vpane, *hpane;
 int        error_count;
 
 #define DIVELIST_DEFAULT_FONT "Sans 8"
@@ -538,9 +539,34 @@ static void about_dialog(GtkWidget *w, gpointer data)
                NULL);
 }
 
+static void view_list(GtkWidget *w, gpointer data)
+{
+       gtk_paned_set_position(GTK_PANED(vpane), 0);
+}
+
+static void view_profile(GtkWidget *w, gpointer data)
+{
+       gtk_paned_set_position(GTK_PANED(hpane), 0);
+       gtk_paned_set_position(GTK_PANED(vpane), 65535);
+}
+
+static void view_info(GtkWidget *w, gpointer data)
+{
+       gtk_paned_set_position(GTK_PANED(vpane), 65535);
+       gtk_paned_set_position(GTK_PANED(hpane), 65535);
+}
+
+/* Ooh. I don't know how to get the half-way size. So I'm just using random numbers */
+static void view_three(GtkWidget *w, gpointer data)
+{
+       gtk_paned_set_position(GTK_PANED(hpane), 400);
+       gtk_paned_set_position(GTK_PANED(vpane), 200);
+}
+
 static GtkActionEntry menu_items[] = {
        { "FileMenuAction", GTK_STOCK_FILE, "File", NULL, NULL, NULL},
        { "LogMenuAction",  GTK_STOCK_FILE, "Log", NULL, NULL, NULL},
+       { "ViewMenuAction",  GTK_STOCK_FILE, "View", NULL, NULL, NULL},
        { "FilterMenuAction",  GTK_STOCK_FILE, "Filter", NULL, NULL, NULL},
        { "HelpMenuAction", GTK_STOCK_HELP, "Help", NULL, NULL, NULL},
        { "OpenFile",       GTK_STOCK_OPEN, NULL,   "<control>O", NULL, G_CALLBACK(file_open) },
@@ -552,6 +578,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) },
 };
 static gint nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]);
 
@@ -571,6 +601,12 @@ static const gchar* ui_string = " \
                        </menu> \
                        <menu name=\"LogMenu\" action=\"LogMenuAction\"> \
                                <menuitem name=\"Renumber\" action=\"Renumber\" /> \
+                               <menu name=\"View\" action=\"ViewMenuAction\"> \
+                                       <menuitem name=\"List\" action=\"ViewList\" /> \
+                                       <menuitem name=\"Profile\" action=\"ViewProfile\" /> \
+                                       <menuitem name=\"Info\" action=\"ViewInfo\" /> \
+                                       <menuitem name=\"Paned\" action=\"ViewThree\" /> \
+                               </menu> \
                        </menu> \
                        <menu name=\"FilterMenu\" action=\"FilterMenuAction\"> \
                                <menuitem name=\"SelectEvents\" action=\"SelectEvents\" /> \
@@ -613,7 +649,6 @@ void init_ui(int *argcp, char ***argvp)
        GtkWidget *stats;
        GtkWidget *menubar;
        GtkWidget *vbox;
-       GtkWidget *hpane, *vpane;
        GdkScreen *screen;
        GtkIconTheme *icon_theme=NULL;
        GtkSettings *settings;