aboutsummaryrefslogtreecommitdiffstats
path: root/divelist.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2013-01-16 12:31:09 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-16 13:04:31 -0800
commit30d090cee2903edc949253cd0a4b7de15f094029 (patch)
tree1f491c3917df39dde3c30ac5fa411c521e91242f /divelist.c
parente9953fa5e6985045c599eec6d63572ee7bb458d7 (diff)
downloadsubsurface-30d090cee2903edc949253cd0a4b7de15f094029.tar.gz
Only offer to show dive on map if we have location information
This adds the "Show in map" menu entry to the divelist only if we actually have a location to show. Of course, having some way to visually see whether we have a GPS location even before we show the menu would probably be good. Maybe a marker in the "location" string or something. But in the meanwhile, at least we don't have that menu entry if we have nothing to show. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'divelist.c')
-rw-r--r--divelist.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/divelist.c b/divelist.c
index c190d7d38..3705c62ad 100644
--- a/divelist.c
+++ b/divelist.c
@@ -2475,9 +2475,13 @@ 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 to show on map if it has a location. */
+ if (dive_has_location(dive)) {
+ 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) {