[gnome-games] collection-header-bar: Stop using stack child properties



commit 4b8ec02ee93cefb267dba6d43133958924c4d5ec
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Mon Aug 19 21:24:56 2019 +0500

    collection-header-bar: Stop using stack child properties
    
    Use visible-child instead of visible-child-name, that way we don't need
    the child property.

 data/ui/collection-header-bar.ui  | 8 +-------
 src/ui/collection-header-bar.vala | 8 ++++++--
 2 files changed, 7 insertions(+), 9 deletions(-)
---
diff --git a/data/ui/collection-header-bar.ui b/data/ui/collection-header-bar.ui
index d3725e1d..66703b45 100644
--- a/data/ui/collection-header-bar.ui
+++ b/data/ui/collection-header-bar.ui
@@ -8,7 +8,7 @@
         <property name="visible">True</property>
         <property name="transition-type">slide-left-right</property>
         <child>
-          <object class="HdyHeaderBar">
+          <object class="HdyHeaderBar" id="header_bar">
             <property name="visible">True</property>
             <property name="show-close-button">True</property>
             <property name="centering-policy">strict</property>
@@ -109,9 +109,6 @@
               </packing>
             </child>
           </object>
-          <packing>
-            <property name="name">main</property>
-          </packing>
         </child>
         <child>
           <object class="GtkHeaderBar" id="subview_header_bar">
@@ -166,9 +163,6 @@
               </packing>
             </child>
           </object>
-          <packing>
-            <property name="name">subview</property>
-          </packing>
         </child>
       </object>
     </child>
diff --git a/src/ui/collection-header-bar.vala b/src/ui/collection-header-bar.vala
index 25dee581..5e8542ce 100644
--- a/src/ui/collection-header-bar.vala
+++ b/src/ui/collection-header-bar.vala
@@ -42,6 +42,8 @@ private class Games.CollectionHeaderBar : Gtk.Bin {
        [GtkChild]
        private Gtk.Stack stack;
        [GtkChild]
+       private Hdy.HeaderBar header_bar;
+       [GtkChild]
        private Gtk.HeaderBar subview_header_bar;
        [GtkChild]
        private Hdy.Squeezer title_squeezer;
@@ -79,8 +81,10 @@ private class Games.CollectionHeaderBar : Gtk.Bin {
        }
 
        private void update_subview () {
-               bool show_subview = adaptive_state.is_subview_open && adaptive_state.is_folded;
-               stack.visible_child_name = show_subview ? "subview" : "main";
+               if (adaptive_state.is_subview_open && adaptive_state.is_folded)
+                       stack.visible_child = subview_header_bar;
+               else
+                       stack.visible_child = header_bar;
        }
 
        private void update_subview_title () {


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