aboutsummaryrefslogtreecommitdiffstats
path: root/gtk-gui.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2011-10-05 08:37:14 -0700
committerGravatar Linus Torvalds <torvalds@linux-foundation.org>2011-10-05 08:37:14 -0700
commit8605d68824042390b858c4ee9b9afdc6844ab312 (patch)
treec0c79545723c3b54cf9785a85f8d28ded0ea638c /gtk-gui.c
parentd6c2236b8a9e20d22d78de7432f7017a18235619 (diff)
downloadsubsurface-8605d68824042390b858c4ee9b9afdc6844ab312.tar.gz
For a manual renumber, default to the existing first dive number
If renumbering a list of dives, default the start number to the existing first dive number. That way, if you do need to renumber (overlapping import or whatever), but your at least had your really old dives already numbered, we start off with a sane default. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'gtk-gui.c')
-rw-r--r--gtk-gui.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gtk-gui.c b/gtk-gui.c
index cecfb7259..be5adb9bd 100644
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -388,6 +388,7 @@ static void preferences_dialog(GtkWidget *w, gpointer data)
static void renumber_dialog(GtkWidget *w, gpointer data)
{
int result;
+ struct dive *dive;
GtkWidget *dialog, *frame, *button, *vbox;
dialog = gtk_dialog_new_with_buttons("Renumber",
@@ -405,6 +406,14 @@ static void renumber_dialog(GtkWidget *w, gpointer data)
button = gtk_spin_button_new_with_range(1, 50000, 1);
gtk_container_add(GTK_CONTAINER(frame), button);
+ /*
+ * Do we have a number for the first dive already? Use that
+ * as the default.
+ */
+ dive = get_dive(0);
+ if (dive && dive->number)
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(button), dive->number);
+
gtk_widget_show_all(dialog);
result = gtk_dialog_run(GTK_DIALOG(dialog));
if (result == GTK_RESPONSE_ACCEPT) {