summaryrefslogtreecommitdiffstats
path: root/gtk-gui.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2012-09-06 12:44:55 -0700
committerGravatar Linus Torvalds <torvalds@linux-foundation.org>2012-09-06 12:44:55 -0700
commit252c28f8f28614383167a20105ef68f4e5b4eb4c (patch)
tree196d323233855984209e206019e600737c25f1e1 /gtk-gui.c
parentd20428973acbd9dd052ae5213098f5ff59df924a (diff)
parent4679f4fbbc1f303b963b4eabebbbc9c684299619 (diff)
downloadsubsurface-252c28f8f28614383167a20105ef68f4e5b4eb4c.tar.gz
Merge branch 'trip3' of git://git.hohndel.org/subsurface
Pull trip manipulation branch from Dirk Hohndel: "I have added yet more of the requested features. I am not aware of any outstanding bugs or crashes (except for the Gtk problem that causes the import to crash for some people on Ubuntu and MacOS - but as I mentioned earlier, that bug has been around as long as the import file selector box)." * 'trip3' of git://git.hohndel.org/subsurface: Avoid duplicate dive_trip entries More trip manipulations: remove selected dives from trip Add ability to merge trip with trip below Use the infrastructure for moving dives in more places Correct the trip related test dives Fix crash when removing the first dive of a trip Correctly initialize the toggle state of the autogroup menu entry Fix copy_tree_node to no longer overwrite dive duration Add autogen menu command Fix a crash when changing sort column Use truth values with gboolean Allow modification and edits of trips Clean up macros and auxiliary functions Store time_t as long value
Diffstat (limited to 'gtk-gui.c')
-rw-r--r--gtk-gui.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/gtk-gui.c b/gtk-gui.c
index 7db777ab9..a2f130ac2 100644
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -634,6 +634,14 @@ static void selectevents_dialog(GtkWidget *w, gpointer data)
gtk_widget_destroy(dialog);
}
+static void autogroup_cb(GtkWidget *w, gpointer data)
+{
+ autogroup = !autogroup;
+ if (! autogroup)
+ remove_autogen_trips();
+ dive_list_update_dives();
+}
+
static void renumber_dialog(GtkWidget *w, gpointer data)
{
int result;
@@ -757,10 +765,15 @@ static GtkActionEntry menu_items[] = {
{ "ViewProfile", NULL, "Profile", CTRLCHAR "2", NULL, G_CALLBACK(view_profile) },
{ "ViewInfo", NULL, "Info", CTRLCHAR "3", NULL, G_CALLBACK(view_info) },
{ "ViewThree", NULL, "Three", CTRLCHAR "4", NULL, G_CALLBACK(view_three) },
- { "ToggleZoom", NULL, "Toggle Zoom", CTRLCHAR "0", NULL, G_CALLBACK(toggle_zoom) },
};
static gint nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]);
+static GtkToggleActionEntry toggle_items[] = {
+ { "Autogroup", NULL, "Autogroup", NULL, NULL, G_CALLBACK(autogroup_cb), FALSE },
+ { "ToggleZoom", NULL, "Toggle Zoom", CTRLCHAR "0", NULL, G_CALLBACK(toggle_zoom), FALSE },
+};
+static gint ntoggle_items = sizeof (toggle_items) / sizeof (toggle_items[0]);
+
static const gchar* ui_string = " \
<ui> \
<menubar name=\"MainMenu\"> \
@@ -779,6 +792,7 @@ static const gchar* ui_string = " \
<menuitem name=\"Add Dive\" action=\"AddDive\" /> \
<separator name=\"Separator\"/> \
<menuitem name=\"Renumber\" action=\"Renumber\" /> \
+ <menuitem name=\"Autogroup\" action=\"Autogroup\" /> \
<menuitem name=\"Toggle Zoom\" action=\"ToggleZoom\" /> \
<menu name=\"View\" action=\"ViewMenuAction\"> \
<menuitem name=\"List\" action=\"ViewList\" /> \
@@ -801,6 +815,8 @@ static GtkWidget *get_menubar_menu(GtkWidget *window, GtkUIManager *ui_manager)
{
GtkActionGroup *action_group = gtk_action_group_new("Menu");
gtk_action_group_add_actions(action_group, menu_items, nmenu_items, 0);
+ toggle_items[0].is_active = autogroup;
+ gtk_action_group_add_toggle_actions(action_group, toggle_items, ntoggle_items, 0);
gtk_ui_manager_insert_action_group(ui_manager, action_group, 0);
GError* error = 0;