mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Prevent UI errors while the the import thread is running
While the import thread is running it is possible to: 1) click the [x] button of the "download dialog". To prevent that, we attach a "delete-event" signal to no-op function. 2) to interact with the main window, once the "accept" event is triggered. To prevent that, we make sure that the window is set back to "modal". Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
27f1339079
commit
a9f44a133d
1 changed files with 10 additions and 0 deletions
10
gtk-gui.c
10
gtk-gui.c
|
@ -1500,6 +1500,12 @@ static GtkWidget *import_dive_computer(device_data_t *data, GtkDialog *dialog)
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* this prevents clicking the [x] button, while the import thread is still running */
|
||||||
|
static void download_dialog_delete(GtkWidget *w, gpointer data)
|
||||||
|
{
|
||||||
|
/* a no-op */
|
||||||
|
}
|
||||||
|
|
||||||
void download_dialog(GtkWidget *w, gpointer data)
|
void download_dialog(GtkWidget *w, gpointer data)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
@ -1517,6 +1523,7 @@ void download_dialog(GtkWidget *w, gpointer data)
|
||||||
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
|
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
|
||||||
GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
|
GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
|
||||||
NULL);
|
NULL);
|
||||||
|
g_signal_connect(dialog, "delete-event", G_CALLBACK(download_dialog_delete), NULL);
|
||||||
|
|
||||||
vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
|
vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
|
||||||
label = gtk_label_new(_(" Please select dive computer and device. "));
|
label = gtk_label_new(_(" Please select dive computer and device. "));
|
||||||
|
@ -1540,6 +1547,9 @@ repeat:
|
||||||
GtkTreeModel *model;
|
GtkTreeModel *model;
|
||||||
|
|
||||||
case GTK_RESPONSE_ACCEPT:
|
case GTK_RESPONSE_ACCEPT:
|
||||||
|
/* once the accept event is triggered the dialog becomes non-modal.
|
||||||
|
* lets re-set that */
|
||||||
|
gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
|
||||||
if (info)
|
if (info)
|
||||||
gtk_widget_destroy(info);
|
gtk_widget_destroy(info);
|
||||||
const char *vendor, *product;
|
const char *vendor, *product;
|
||||||
|
|
Loading…
Add table
Reference in a new issue