summaryrefslogtreecommitdiffstats
path: root/gtk-gui.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2012-05-02 13:45:52 -0700
committerGravatar Linus Torvalds <torvalds@linux-foundation.org>2012-05-02 13:45:52 -0700
commit26b90cbfa8d289c7b05a3704a35d9452cf4a235f (patch)
treebb174d5d34ba3227db660fb8c69a978e8add0acc /gtk-gui.c
parent11db04b350382c021edf83e2f91b3cace090989b (diff)
downloadsubsurface-26b90cbfa8d289c7b05a3704a35d9452cf4a235f.tar.gz
Change the Dive computer import button from "Ok" to "Retry" on error
This was a todo item in commit b0ba22a06879 ("Show dive import error messages in the import dialog") which made the import dialog able to retry the import on errors. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'gtk-gui.c')
-rw-r--r--gtk-gui.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/gtk-gui.c b/gtk-gui.c
index 23848f892..469840b7d 100644
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -1013,20 +1013,26 @@ static void do_import_file(gpointer data, gpointer user_data)
}
}
-static GtkWidget *import_dive_computer(device_data_t *data, GtkBox *vbox)
+static GtkWidget *import_dive_computer(device_data_t *data, GtkDialog *dialog)
{
GError *error;
- GtkWidget *info, *container, *label;
+ GtkWidget *vbox, *info, *container, *label, *button;
error = do_import(data);
if (!error)
return NULL;
+ button = gtk_dialog_get_widget_for_response(dialog, GTK_RESPONSE_ACCEPT);
+ gtk_button_set_use_stock(GTK_BUTTON(button), 0);
+ gtk_button_set_label(GTK_BUTTON(button), "Retry");
+
+ vbox = gtk_dialog_get_content_area(dialog);
+
info = gtk_info_bar_new();
container = gtk_info_bar_get_content_area(GTK_INFO_BAR(info));
label = gtk_label_new(error->message);
gtk_container_add(GTK_CONTAINER(container), label);
- gtk_box_pack_start(vbox, info, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(vbox), info, FALSE, FALSE, 0);
return info;
}
@@ -1086,7 +1092,7 @@ repeat:
devicedata.name = comp;
devicedata.devname = gtk_entry_get_text(device);
set_default_dive_computer(devicedata.name);
- info = import_dive_computer(&devicedata, GTK_BOX(vbox));
+ info = import_dive_computer(&devicedata, GTK_DIALOG(dialog));
if (info)
goto repeat;
} else {