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.
This commit is contained in:
Ian Douglas Scott 2021-04-14 09:01:32 -07:00 committed by Georges Basile Stavracas Neto
parent e9cc111854
commit b804fdb01a

View file

@ -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