summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Jakeman <mjakeman26@outlook.co.nz>2021-12-14 18:32:57 +1300
committerMatt Jakeman <mjak923@aucklanduni.ac.nz>2021-12-16 10:48:43 +0000
commitd87f5be77bb4ee03e363cb560aaefb00cf56b275 (patch)
tree5191478197993d78b8db52f4eab1df63bd72bc0e
parent68f09e5bd6d53bef64f9b4419adf9b986eca1422 (diff)
downloadnautilus-d87f5be77bb4ee03e363cb560aaefb00cf56b275.tar.gz
autorun-software: Stop using blocking dialog functions
Replaces gtk_dialog_run() with equivalent non-blocking behaviour for the nautilus-autorun-software utility. Part of #1992
-rw-r--r--src/nautilus-autorun-software.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/nautilus-autorun-software.c b/src/nautilus-autorun-software.c
index e0043ca30..edf0a35fb 100644
--- a/src/nautilus-autorun-software.c
+++ b/src/nautilus-autorun-software.c
@@ -161,8 +161,25 @@ out:
* there is no way to get it back. */
gtk_window_set_keep_above (GTK_WINDOW (dialog), TRUE);
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
+ g_signal_connect (dialog,
+ "response",
+ G_CALLBACK (gtk_widget_destroy),
+ NULL);
+
+ gtk_widget_show_all (dialog);
+ }
+}
+
+static void
+autorun_software_dialog_response (GtkDialog *dialog,
+ gint response_id,
+ GMount *mount)
+{
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+
+ if (response_id == GTK_RESPONSE_OK)
+ {
+ autorun (mount);
}
}
@@ -223,13 +240,12 @@ present_autorun_for_software_dialog (GMount *mount)
_("_Run"),
GTK_RESPONSE_OK);
- gtk_widget_show_all (dialog);
+ g_signal_connect (dialog,
+ "response",
+ G_CALLBACK (autorun_software_dialog_response),
+ mount);
- if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
- {
- gtk_widget_destroy (dialog);
- autorun (mount);
- }
+ gtk_widget_show_all (dialog);
}
int