[gtk+] inspector: Handle the dialog more carefully



commit b369719bcd8317f57da45f5188c13c6cc36471c8
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Jul 2 22:52:10 2014 -0400

    inspector: Handle the dialog more carefully
    
    When showing and hiding the inspector window repeatedly without
    dismissing the dialog, we were hiding the inspector, but not
    the dialog, leading to a confusing user experience.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=732443

 gtk/gtkwindow.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 45db973..de2057b 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -11872,6 +11872,7 @@ warn_response (GtkDialog *dialog,
                gint       response)
 {
   gtk_widget_destroy (GTK_WIDGET (dialog));
+  g_object_set_data (inspector_window, "warning_dialog", NULL);
   if (response == GTK_RESPONSE_NO)
     {
       gtk_widget_destroy (inspector_window);
@@ -11913,9 +11914,12 @@ gtk_window_set_debugging (gboolean enable,
           gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Cancel"), GTK_RESPONSE_NO);
           gtk_dialog_add_button (GTK_DIALOG (dialog), _("_OK"), GTK_RESPONSE_YES);
           g_signal_connect (dialog, "response", G_CALLBACK (warn_response), NULL);
+          g_object_set_data (inspector_window, "warning_dialog", dialog);
         }
     }
 
+  dialog = g_object_get_data (inspector_window, "warning_dialog");
+
   if (enable)
     {
       gtk_window_present (GTK_WINDOW (inspector_window));
@@ -11923,7 +11927,11 @@ gtk_window_set_debugging (gboolean enable,
         g_timeout_add (200, show_dialog, dialog);
     }
   else
-    gtk_widget_hide (inspector_window);
+    {
+      if (dialog)
+        gtk_widget_hide (dialog);
+      gtk_widget_hide (inspector_window);
+    }
 }
 
 /**


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