summaryrefslogtreecommitdiffstats
path: root/gtk-gui.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2012-12-17 09:37:07 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-12-17 08:29:39 -1000
commitd8fd8b2099a4c0ebbb642993333abdc670763301 (patch)
treeebd0f938abafa147995c19f9dd041b20d2e2197e /gtk-gui.c
parenta691a8e5a35f2277d9a8c911696a4d0a394bb42e (diff)
downloadsubsurface-d8fd8b2099a4c0ebbb642993333abdc670763301.tar.gz
Add a "View next dive computer" menu item
This adds the capability to actually view all your dive computers, by adding a menu item under "Log"->"View"->"Next DC" to show the next dive computer. Realistically, if you actually commonly use this, you'd use the accelerator shortcut. Which right now is Ctrl-C ("C for Computer"), which is probably a horrible choice. I really would want to have nice "next/prev dive" accelerators too, because the cursor keys don't work very well with the gtk focus issues. Being able to switch between dives would also make the "just the dive profile, maam" view (ctrl-2) much more useful. The prev/next dive in the profile view should probably be done with a keyboard action callback, which also avoids some of the limitations of accelerators (ie you can make any key do the action). Some gtk person, please? Anyway, this commit only does the dive computer choice thing, and only using the accelerators. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'gtk-gui.c')
-rw-r--r--gtk-gui.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gtk-gui.c b/gtk-gui.c
index 4d795be1d..c22d2b573 100644
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -1014,6 +1014,13 @@ static void toggle_zoom(GtkWidget *w, gpointer data)
repaint_dive();
}
+static void next_dc(GtkWidget *w, gpointer data)
+{
+ dc_number++;
+ /* If the dc number overflows, we'll "wrap around" and zero it */
+ repaint_dive();
+}
+
static GtkActionEntry menu_items[] = {
{ "FileMenuAction", NULL, N_("File"), NULL, NULL, NULL},
{ "LogMenuAction", NULL, N_("Log"), NULL, NULL, NULL},
@@ -1039,6 +1046,7 @@ static GtkActionEntry menu_items[] = {
{ "ViewProfile", NULL, N_("Profile"), CTRLCHAR "2", NULL, G_CALLBACK(view_profile) },
{ "ViewInfo", NULL, N_("Info"), CTRLCHAR "3", NULL, G_CALLBACK(view_info) },
{ "ViewThree", NULL, N_("Three"), CTRLCHAR "4", NULL, G_CALLBACK(view_three) },
+ { "NextDC", NULL, N_("Next DC"), CTRLCHAR "C", NULL, G_CALLBACK(next_dc) },
};
static gint nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]);
@@ -1080,6 +1088,7 @@ static const gchar* ui_string = " \
<menuitem name=\"Profile\" action=\"ViewProfile\" /> \
<menuitem name=\"Info\" action=\"ViewInfo\" /> \
<menuitem name=\"Paned\" action=\"ViewThree\" /> \
+ <menuitem name=\"NextDC\" action=\"NextDC\" /> \
</menu> \
</menu> \
<menu name=\"FilterMenu\" action=\"FilterMenuAction\"> \