From 6dfd16a1f51f20dfff180d0ae238af3ee8667605 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 14 May 2013 21:22:03 -0400 Subject: [PATCH] When editing a manually entered dive, make sure divelist is updated Editing a manually entered dive allows the user to edit duration, max depth and mean depth. These values are stored in the first (and only) divecomputer and the duration, maxdepth and meandepth fields of the dive are populated in fixup_dive() after the dive was initially parsed. In order for this to work we need to clear out the existing fields (so that values can get smaller) and rerun fixup_dive(). Signed-off-by: Dirk Hohndel --- info-gtk.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/info-gtk.c b/info-gtk.c index cb9d87b7b..8e9b9442a 100644 --- a/info-gtk.c +++ b/info-gtk.c @@ -777,8 +777,15 @@ int edit_multi_dive_info(struct dive *single_dive) update_cylinder_related_info(master); /* if there was only one dive we might also have changed dive->when * or even the duration and depth information (in a dive without samples) */ - if (! multi) + if (! multi) { update_time_depth(master, &edit_dive); + /* these values could have changed because of the edit - so let's + * recreate them */ + master->duration.seconds = 0; + master->maxdepth.mm = 0; + master->meandepth.mm = 0; + (void)fixup_dive(master); + } dive_list_update_dives(); } gtk_widget_destroy(dialog);