[gnome-control-center] background: ensure background chooser is closed if panel changed



commit 9bad43e484b350f82574269b5baca2c444cb6f59
Author: Joshua Lock <joshua lock intel com>
Date:   Mon Jun 3 15:41:02 2013 -0700

    background: ensure background chooser is closed if panel changed
    
    If the background chooser is open and the user triggers a switch to a
    different panel (i.e. from one of the gnome-shell indicators) the chooser
    is still the topmost window and modal for g-c-c, however if the chooser is
    interacted with in any way other than clicking the cancel button g-c-c
    crashes.
    
    Ensure that the chooser is destroyed if the panel is changed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=700860

 panels/background/cc-background-panel.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/panels/background/cc-background-panel.c b/panels/background/cc-background-panel.c
index 86e7250..480cd73 100644
--- a/panels/background/cc-background-panel.c
+++ b/panels/background/cc-background-panel.c
@@ -64,6 +64,7 @@ struct _CcBackgroundPanelPrivate
   GCancellable *capture_cancellable;
 
   GtkWidget *spinner;
+  GtkWidget *chooser;
 
   GdkPixbuf *display_screenshot;
   char *screenshot_path;
@@ -107,6 +108,12 @@ cc_background_panel_dispose (GObject *object)
       priv->capture_cancellable = NULL;
     }
 
+  if (priv->chooser)
+    {
+      gtk_widget_destroy (priv->chooser);
+      priv->chooser = NULL;
+    }
+
   g_clear_object (&priv->thumb_factory);
   g_clear_object (&priv->display_screenshot);
 
@@ -716,6 +723,8 @@ on_background_button_clicked (GtkButton         *button,
                                 GTK_WINDOW (gtk_widget_get_toplevel (WID ("background-panel"))));
   gtk_widget_show (dialog);
   g_signal_connect (dialog, "response", G_CALLBACK (on_chooser_dialog_response), self);
+  priv->chooser = dialog;
+  g_object_add_weak_pointer (G_OBJECT (dialog), (gpointer *) &priv->chooser);
 }
 
 static void


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