diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-05-15 12:47:05 -0400 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-05-15 13:08:40 -0400 |
commit | b6ec31309651eae6387c1eb6e4e4fe7601fd8f28 (patch) | |
tree | e0038b04f69deac6a774b95193ff07982774ec78 /info-gtk.c | |
parent | ac1644454471d1c9e842c3a411cbd4bfbf721953 (diff) | |
download | subsurface-b6ec31309651eae6387c1eb6e4e4fe7601fd8f28.tar.gz |
Edit depth/duration dialog incorrectly always used metric
The label changed, but when the value was pre-set, it was always set as
metric (but then "correctly" interpreted as ft when reading it back - i.e.
it was incorrectly devided by 3.3).
Reported-by: Thomas Maisl <tom@maisl.net>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'info-gtk.c')
-rw-r--r-- | info-gtk.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/info-gtk.c b/info-gtk.c index 8e9b9442a..87f4b96bc 100644 --- a/info-gtk.c +++ b/info-gtk.c @@ -925,8 +925,13 @@ static int dive_time_widget(struct dive *dive, edit_control_t editing) depthinterval = 0.1; } depth = gtk_spin_button_new_with_range (0.0, 1000.0, depthinterval); - if (editing != EDIT_NEW_DIVE) - gtk_spin_button_set_value(GTK_SPIN_BUTTON(depth), dive->dc.maxdepth.mm / 1000.0); + if (editing != EDIT_NEW_DIVE) { + if (prefs.units.length == FEET) { + gtk_spin_button_set_value(GTK_SPIN_BUTTON(depth), mm_to_feet(dive->dc.maxdepth.mm)); + } else { + gtk_spin_button_set_value(GTK_SPIN_BUTTON(depth), dive->dc.maxdepth.mm / 1000.0); + } + } gtk_box_pack_end(GTK_BOX(box), depth, FALSE, FALSE, 0); box = frame_box(hbox, _("Avg Depth (%s):"), prefs.units.length == FEET ? _("ft") : _("m")); @@ -936,8 +941,13 @@ static int dive_time_widget(struct dive *dive, edit_control_t editing) depthinterval = 0.1; } avgdepth = gtk_spin_button_new_with_range (0.0, 1000.0, depthinterval); - if (editing != EDIT_NEW_DIVE) - gtk_spin_button_set_value(GTK_SPIN_BUTTON(avgdepth), dive->dc.meandepth.mm / 1000.0); + if (editing != EDIT_NEW_DIVE) { + if (prefs.units.length == FEET) { + gtk_spin_button_set_value(GTK_SPIN_BUTTON(avgdepth), mm_to_feet(dive->dc.meandepth.mm)); + } else { + gtk_spin_button_set_value(GTK_SPIN_BUTTON(avgdepth), dive->dc.meandepth.mm / 1000.0); + } + } gtk_box_pack_end(GTK_BOX(box), avgdepth, FALSE, FALSE, 0); } /* All done, show it and wait for editing */ |