[gnome-control-center] display: Close the dialog when the RR configuration changes



commit 03d9a96c672148de8d740855be1b49a3de513d25
Author: Rui Matos <tiagomatos gmail com>
Date:   Thu Mar 26 16:01:04 2015 +0100

    display: Close the dialog when the RR configuration changes
    
    We assume that the RR configuration is valid in various callbacks from
    both our modal dialogs which doesn't hold if there's an hotplug while
    a dialog is open (e.g. monitor is plugged/unplugged).
    
    Closing the dialog in that case seems the right thing to do since it
    would be operating on an outdated view of the world otherwise and
    likely end up crashing.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=655041

 panels/display/cc-display-panel.c |   17 +++++------------
 1 files changed, 5 insertions(+), 12 deletions(-)
---
diff --git a/panels/display/cc-display-panel.c b/panels/display/cc-display-panel.c
index 5bf9279..9c5f1a3 100644
--- a/panels/display/cc-display-panel.c
+++ b/panels/display/cc-display-panel.c
@@ -468,6 +468,9 @@ on_screen_changed (CcDisplayPanel *panel)
   GtkSizeGroup *sizegroup;
   GList *sorted_outputs = NULL, *l;
 
+  if (priv->dialog)
+    gtk_dialog_response (GTK_DIALOG (priv->dialog), GTK_RESPONSE_NONE);
+
   gnome_rr_screen_refresh (priv->screen, NULL);
 
   current = gnome_rr_config_new_current (priv->screen, NULL);
@@ -1613,12 +1616,7 @@ show_arrange_displays_dialog (GtkButton      *button,
   response = gtk_dialog_run (GTK_DIALOG (priv->dialog));
   if (response == GTK_RESPONSE_ACCEPT)
     apply_current_configuration (panel);
-  else if (response == GTK_RESPONSE_NONE)
-    {
-      /* panel is being destroyed */
-      return;
-    }
-  else
+  else if (response != GTK_RESPONSE_NONE)
     {
       /* re-read the previous configuration */
       on_screen_changed (panel);
@@ -2339,12 +2337,7 @@ show_setup_dialog (CcDisplayPanel *panel)
 
       apply_current_configuration (panel);
     }
-  else if (response == GTK_RESPONSE_NONE)
-    {
-      /* panel is being destroyed */
-      return;
-    }
-  else
+  else if (response != GTK_RESPONSE_NONE)
     {
       /* changes cancelled, so re-read the current configuration */
       on_screen_changed (panel);


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