[gnome-control-center] shell: Remove prior panel at the last minute



commit e01e33e76e777142db01fa220c789779fd569256
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Apr 30 17:07:36 2012 +0100

    shell: Remove prior panel at the last minute
    
    Once we've already switch to a new panel.

 shell/gnome-control-center.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/shell/gnome-control-center.c b/shell/gnome-control-center.c
index e5f12de..89a4bc9 100644
--- a/shell/gnome-control-center.c
+++ b/shell/gnome-control-center.c
@@ -948,17 +948,29 @@ _shell_set_active_panel_from_id (CcShell      *shell,
 
   if (!name)
     {
+      gtk_container_remove (GTK_CONTAINER (priv->notebook), priv->current_panel);
+      priv->current_panel = NULL;
+      shell_set_current_notebook_widget (GTK_NOTEBOOK (priv->notebook),
+					 priv->scrolled_window);
       g_warning ("Could not find settings panel \"%s\"", start_id);
       return FALSE;
     }
   else
     {
-      if (priv->current_panel)
-        gtk_container_remove (GTK_CONTAINER (priv->notebook), priv->current_panel);
+      GtkWidget *old_panel;
+
+      old_panel = priv->current_panel;
       priv->current_panel = NULL;
 
-      activate_panel (GNOME_CONTROL_CENTER (shell), start_id, argv, desktop,
-		      name, gicon);
+      if (activate_panel (GNOME_CONTROL_CENTER (shell), start_id, argv, desktop,
+			  name, gicon) == FALSE)
+        {
+          shell_set_current_notebook_widget (GTK_NOTEBOOK (priv->notebook),
+					     priv->scrolled_window);
+        }
+
+      if (old_panel)
+        gtk_container_remove (GTK_CONTAINER (priv->notebook), old_panel);
 
       g_free (name);
       g_free (desktop);



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