[gnome-control-center] shell: Fix bug when multiple panels use custom sidebar widget



commit b804fdb01ab30aba9441ae0631b2cd1e262c7c8d
Author: Ian Douglas Scott <idscott system76 com>
Date:   Wed Apr 14 09:01:32 2021 -0700

    shell: Fix bug when multiple panels use custom sidebar widget
    
    This is not currently a problem because the feature is only used in the
    Applications panel, but this fixes the behavior if a custom sidebar is used
    in more than one panel.

 shell/cc-panel-list.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/shell/cc-panel-list.c b/shell/cc-panel-list.c
index e23da0b87..a8eb279d7 100644
--- a/shell/cc-panel-list.c
+++ b/shell/cc-panel-list.c
@@ -1068,20 +1068,19 @@ void
 cc_panel_list_add_sidebar_widget (CcPanelList *self,
                                   GtkWidget   *widget)
 {
+  GtkWidget *previous;
+
   g_return_if_fail (CC_IS_PANEL_LIST (self));
 
+  previous = get_widget_from_view (self, CC_PANEL_LIST_WIDGET);
+  if (previous)
+    gtk_container_remove (GTK_CONTAINER (self), previous);
+
   if (widget)
     {
       gtk_stack_add_named (GTK_STACK (self), widget, "custom-widget");
       switch_to_view (self, CC_PANEL_LIST_WIDGET);
     }
-  else
-    {
-      widget = get_widget_from_view (self, CC_PANEL_LIST_WIDGET);
-
-      if (widget)
-        gtk_container_remove (GTK_CONTAINER (self), widget);
-    }
 }
 
 void


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