[gtk/ebassi/run-dialog-run: 105/116] Remove gtk_dialog_run() from GtkMountOperation



commit f573a1f3f2e841eeaa23cf771ee277cc34b8cb5b
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Thu Apr 30 13:43:17 2020 +0100

    Remove gtk_dialog_run() from GtkMountOperation

 gtk/gtkmountoperation.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkmountoperation.c b/gtk/gtkmountoperation.c
index 1347cd489e..c39ef85aac 100644
--- a/gtk/gtkmountoperation.c
+++ b/gtk/gtkmountoperation.c
@@ -1343,6 +1343,18 @@ update_process_list_store (GtkMountOperation *mount_operation,
   g_array_unref (pid_indices_to_remove);
 }
 
+static void
+on_dialog_response (GtkDialog *dialog,
+                    int        response)
+{
+  /* GTK_RESPONSE_NONE means the dialog were programmatically destroy, e.g. that
+   * GTK_DIALOG_DESTROY_WITH_PARENT kicked in - so it would trigger a warning to
+   * destroy the dialog in that case
+   */
+  if (response != GTK_RESPONSE_NONE)
+    gtk_window_destroy (GTK_WINDOW (dialog));
+}
+
 static void
 on_end_process_activated (GtkModelButton *button,
                           gpointer user_data)
@@ -1379,7 +1391,6 @@ on_end_process_activated (GtkModelButton *button,
   if (!_gtk_mount_operation_kill_process (pid_to_kill, &error))
     {
       GtkWidget *dialog;
-      gint response;
 
       /* Use GTK_DIALOG_DESTROY_WITH_PARENT here since the parent dialog can be
        * indeed be destroyed via the GMountOperation::abort signal... for example,
@@ -1396,14 +1407,8 @@ on_end_process_activated (GtkModelButton *button,
                                                 error->message);
 
       gtk_widget_show (dialog);
-      response = gtk_dialog_run (GTK_DIALOG (dialog));
 
-      /* GTK_RESPONSE_NONE means the dialog were programmatically destroy, e.g. that
-       * GTK_DIALOG_DESTROY_WITH_PARENT kicked in - so it would trigger a warning to
-       * destroy the dialog in that case
-       */
-      if (response != GTK_RESPONSE_NONE)
-        gtk_window_destroy (GTK_WINDOW (dialog));
+      g_signal_connect (dialog, "response", G_CALLBACK (on_dialog_response), NULL);
 
       g_error_free (error);
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]