From 1ba901fed670ecf55e44b0d8aafb78ede53c9105 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 16 May 2013 09:09:06 -0700 Subject: Initialize / reset selected_dive to -1 The value of 0 that we used is actually a valid value and could cause confusion. Suggested-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- divelist-gtk.c | 2 +- gtk-gui.c | 2 +- profile.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/divelist-gtk.c b/divelist-gtk.c index e7194d87e..3f96193c5 100644 --- a/divelist-gtk.c +++ b/divelist-gtk.c @@ -1319,7 +1319,7 @@ static void delete_selected_dives_cb(GtkWidget *menuitem, GtkTreePath *path) /* if no dives are selected at this point clear the display widgets */ if (!amount_selected) { - selected_dive = 0; + selected_dive = -1; process_selected_dives(); clear_stats_widgets(); clear_equipment_widgets(); diff --git a/gtk-gui.c b/gtk-gui.c index 2797b8fa6..b8d749858 100644 --- a/gtk-gui.c +++ b/gtk-gui.c @@ -268,7 +268,7 @@ static void file_close(GtkWidget *w, gpointer data) mark_divelist_changed(FALSE); /* clear the selection and the statistics */ - selected_dive = 0; + selected_dive = -1; process_selected_dives(); clear_stats_widgets(); clear_events(); diff --git a/profile.c b/profile.c index 18960fcff..e40ee5bad 100644 --- a/profile.c +++ b/profile.c @@ -12,7 +12,7 @@ #include "libdivecomputer/parser.h" #include "libdivecomputer/version.h" -int selected_dive = 0; +int selected_dive = -1; /* careful: 0 is a valid value */ char zoomed_plot = 0; char dc_number = 0; -- cgit v1.2.3-70-g09d2