summaryrefslogtreecommitdiffstats
path: root/divelist.c
diff options
context:
space:
mode:
authorGravatar Henrik Brautaset Aronsen <subsurface@henrik.synth.no>2013-01-15 22:45:18 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-15 17:41:57 -0800
commite9953fa5e6985045c599eec6d63572ee7bb458d7 (patch)
tree03d31f275c479b2663fb5f0ffcf29ceba17ad0c7 /divelist.c
parent3fb80bcaeb5e3d1d5e447ea29e6bcb6ad619647a (diff)
downloadsubsurface-e9953fa5e6985045c599eec6d63572ee7bb458d7.tar.gz
Show single dives in map.
This adds a "Show in map" entry in the dive list context menu. It will zoom to the dive location if it exists, otherwise the full map will be displayed. I've also switched map tiles from OpenStreetMap to Google Maps just to show off that we can. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'divelist.c')
-rw-r--r--divelist.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/divelist.c b/divelist.c
index e6fb710b5..c190d7d38 100644
--- a/divelist.c
+++ b/divelist.c
@@ -1659,6 +1659,11 @@ void edit_dive_when_cb(GtkWidget *menuitem, struct dive *dive)
}
}
+static void show_gps_location_cb(GtkWidget *menuitem, struct dive *dive)
+{
+ show_gps_location(dive);
+}
+
static void expand_all_cb(GtkWidget *menuitem, GtkTreeView *tree_view)
{
gtk_tree_view_expand_all(tree_view);
@@ -2470,6 +2475,10 @@ static void popup_divelist_menu(GtkTreeView *tree_view, GtkTreeModel *model, int
g_signal_connect(menuitem, "activate", G_CALLBACK(edit_dive_from_path_cb), path);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
}
+ menuitem = gtk_menu_item_new_with_label(_("Show in map"));
+ g_signal_connect(menuitem, "activate", G_CALLBACK(show_gps_location_cb), dive);
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
+
/* only offer trip editing options when we are displaying the tree model */
if (dive_list.model == dive_list.treemodel) {
int depth = gtk_tree_path_get_depth(path);
@@ -2503,9 +2512,11 @@ static void popup_divelist_menu(GtkTreeView *tree_view, GtkTreeModel *model, int
menuitem = gtk_menu_item_new_with_label(_("Expand all"));
g_signal_connect(menuitem, "activate", G_CALLBACK(expand_all_cb), tree_view);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
+
menuitem = gtk_menu_item_new_with_label(_("Collapse all"));
g_signal_connect(menuitem, "activate", G_CALLBACK(collapse_all_cb), tree_view);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
+
gtk_widget_show_all(menu);
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,