[PATCH] Repair broken Add Dive menu item

subsurface at henrik.synth.no subsurface at henrik.synth.no
Sun Nov 4 11:35:59 PST 2012


From: Henrik Brautaset Aronsen <subsurface at henrik.synth.no>

Lubomir's commit aec904b612cbee57f8bb5c3289a120b69c9ade24 broke the Add
Dive menu item:  The Edit Dive dialogue didn't show up after the initial
dialogue.

Signed-off-by: Henrik Brautaset Aronsen <subsurface at henrik.synth.no>
---
 dive.h     | 2 +-
 divelist.c | 2 +-
 info.c     | 7 ++++---
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/dive.h b/dive.h
index c190165..d9f587a 100644
--- a/dive.h
+++ b/dive.h
@@ -415,7 +415,7 @@ extern void evn_foreach(void (*callback)(const char *, int *, void *), void *dat
 
 extern int add_new_dive(struct dive *dive);
 extern gboolean edit_trip(dive_trip_t *trip);
-extern int edit_dive_info(struct dive *dive);
+extern int edit_dive_info(struct dive *dive, gboolean newdive);
 extern int edit_multi_dive_info(struct dive *single_dive);
 extern void dive_list_update_dives(void);
 extern void flush_divelist(struct dive *dive);
diff --git a/divelist.c b/divelist.c
index c1e240d..498210e 100644
--- a/divelist.c
+++ b/divelist.c
@@ -1340,7 +1340,7 @@ static void row_activated_cb(GtkTreeView *tree_view,
 		collapse_expand(tree_view, path);
 		return;
 	}
-	edit_dive_info(get_dive(index));
+	edit_dive_info(get_dive(index), FALSE);
 }
 
 void add_dive_cb(GtkWidget *menuitem, gpointer data)
diff --git a/info.c b/info.c
index 6501150..ee27c45 100644
--- a/info.c
+++ b/info.c
@@ -792,10 +792,11 @@ int edit_multi_dive_info(struct dive *single_dive)
 	return success;
 }
 
-int edit_dive_info(struct dive *dive)
+int edit_dive_info(struct dive *dive, gboolean newdive)
 {
-	if (!dive || !amount_selected)
+	if (!dive || (!newdive && !amount_selected))
 		return 0;
+
 	return edit_multi_dive_info(dive);
 }
 
@@ -938,7 +939,7 @@ int add_new_dive(struct dive *dive)
 	if (!dive_time_widget(dive))
 		return 0;
 
-	return edit_dive_info(dive);
+	return edit_dive_info(dive, TRUE);
 }
 
 GtkWidget *extended_dive_info_widget(void)
-- 
1.8.0



More information about the subsurface mailing list