[gnome-control-center] cc-window: Use AdwLeaflet's navigation API



commit 617341591bf4a62170a3ca0a189b9aac93c99741
Author: Christopher Davis <christopherdavis gnome org>
Date:   Mon Jan 3 16:34:31 2022 -0800

    cc-window: Use AdwLeaflet's navigation API
    
    This should be preferred over `set_visible_child ()`

 shell/cc-window.c | 23 ++++++-----------------
 1 file changed, 6 insertions(+), 17 deletions(-)
---
diff --git a/shell/cc-window.c b/shell/cc-window.c
index b3a960f48..a9a90f549 100644
--- a/shell/cc-window.c
+++ b/shell/cc-window.c
@@ -150,22 +150,10 @@ remove_all_custom_widgets (CcWindow *self)
   CC_EXIT;
 }
 
-static void
-show_panel (CcWindow *self)
-{
-  adw_leaflet_set_visible_child (self->main_leaflet, GTK_WIDGET (self->panel_box));
-}
-
-static void
-show_sidebar (CcWindow *self)
-{
-  adw_leaflet_set_visible_child (self->main_leaflet, GTK_WIDGET (self->sidebar_box));
-}
-
 static void
 on_sidebar_activated_cb (CcWindow *self)
 {
-  show_panel (self);
+  adw_leaflet_navigate (self->main_leaflet, ADW_NAVIGATION_DIRECTION_FORWARD);
 }
 
 static gboolean
@@ -444,7 +432,7 @@ set_active_panel_from_id (CcWindow     *self,
     {
       g_object_set (G_OBJECT (self->current_panel), "parameters", parameters, NULL);
       if (force_moving_to_the_panel || self->previous_list_view == view)
-        show_panel (self);
+        adw_leaflet_navigate (self->main_leaflet, ADW_NAVIGATION_DIRECTION_FORWARD);
       self->previous_list_view = view;
       CC_RETURN (TRUE);
     }
@@ -480,7 +468,7 @@ set_active_panel_from_id (CcWindow     *self,
     add_current_panel_to_history (self, start_id);
 
   if (force_moving_to_the_panel)
-    show_panel (self);
+    adw_leaflet_navigate (self->main_leaflet, ADW_NAVIGATION_DIRECTION_FORWARD);
 
   g_free (self->current_panel_id);
   self->current_panel_id = g_strdup (start_id);
@@ -575,7 +563,7 @@ search_entry_activate_cb (CcWindow *self)
 static void
 back_button_clicked_cb (CcWindow *self)
 {
-  show_sidebar (self);
+  adw_leaflet_navigate (self->main_leaflet, ADW_NAVIGATION_DIRECTION_BACK);
 }
 
 static void
@@ -832,7 +820,8 @@ cc_window_constructed (GObject *object)
                             self);
 
   update_headerbar_buttons (self);
-  show_sidebar (self);
+  adw_leaflet_set_visible_child (self->main_leaflet,
+                                 GTK_WIDGET (self->sidebar_box));
 
   G_OBJECT_CLASS (cc_window_parent_class)->constructed (object);
 }


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