summaryrefslogtreecommitdiffstats
path: root/info-gtk.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-14 21:22:03 -0400
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-14 21:22:03 -0400
commit6dfd16a1f51f20dfff180d0ae238af3ee8667605 (patch)
tree8af87ff0c36109e67be4e992dee5f2084212eec5 /info-gtk.c
parent41a97bc1ae1d16053d5f0374c319a9011ffe06a2 (diff)
downloadsubsurface-6dfd16a1f51f20dfff180d0ae238af3ee8667605.tar.gz
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 <dirk@hohndel.org>
Diffstat (limited to 'info-gtk.c')
-rw-r--r--info-gtk.c9
1 files changed, 8 insertions, 1 deletions
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);