diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-12-06 13:00:01 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-12-06 13:00:01 -0800 |
commit | 7721036fabb91902acfbf929ff450f59971cc4a3 (patch) | |
tree | 7c3958c86e5814ea023ac489dfa304d9920f14d8 /gtk-gui.c | |
parent | ce6c3ee56d372e2ef8386a065fbf4bce4cfa0ffc (diff) | |
download | subsurface-7721036fabb91902acfbf929ff450f59971cc4a3.tar.gz |
Add shorthand actions for showing just one of the panes
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>
Diffstat (limited to 'gtk-gui.c')
-rw-r--r-- | gtk-gui.c | 37 |
1 files changed, 36 insertions, 1 deletions
@@ -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; |