[gnome-games/wip/exalm/spinner-performance: 13/19] sidebar-view: Add collapsed property



commit 6aee31d1ac64413b7665244dccb8911b7fd8de8c
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Fri Sep 21 22:41:36 2018 +0500

    sidebar-view: Add collapsed property

 data/ui/collection-box.ui  | 2 +-
 src/ui/collection-box.vala | 2 ++
 src/ui/games-view.vala     | 4 ++++
 src/ui/sidebar-view.vala   | 3 +++
 4 files changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/data/ui/collection-box.ui b/data/ui/collection-box.ui
index 46a8a962..25af85bc 100644
--- a/data/ui/collection-box.ui
+++ b/data/ui/collection-box.ui
@@ -34,7 +34,7 @@
                 <property name="visible">True</property>
                 <child>
                   <object class="GtkStack" id="viewstack">
-                    <property name="visible">True</property>
+                    <property name="visible">False</property>
                     <property name="visible-child">games_view</property>
                     <property name="transition-type">none</property>
                     <signal name="notify::visible-child" handler="on_visible_child_changed"/>
diff --git a/src/ui/collection-box.vala b/src/ui/collection-box.vala
index b792d1f6..47ae0f0b 100644
--- a/src/ui/collection-box.vala
+++ b/src/ui/collection-box.vala
@@ -135,6 +135,8 @@ private class Games.CollectionBox : Gtk.Box {
 
                var view = viewstack.visible_child as SidebarView;
 
+               viewstack.visible = !view.is_collapsed;
+
                view.select_default_row ();
        }
 
diff --git a/src/ui/games-view.vala b/src/ui/games-view.vala
index e48f39c5..6670486e 100644
--- a/src/ui/games-view.vala
+++ b/src/ui/games-view.vala
@@ -1,6 +1,10 @@
 // This file is part of GNOME Games. License: GPL-3.0+.
 
 private class Games.GamesView : SidebarView {
+       construct {
+               is_collapsed = true;
+       }
+
        protected override void game_added (Game game) {}
 
        protected override void invalidate (Gtk.ListBoxRow row_item) {}
diff --git a/src/ui/sidebar-view.vala b/src/ui/sidebar-view.vala
index 4cec2e0f..65f585ed 100644
--- a/src/ui/sidebar-view.vala
+++ b/src/ui/sidebar-view.vala
@@ -37,6 +37,8 @@ private abstract class Games.SidebarView : Gtk.Bin {
                }
        }
 
+       public bool is_collapsed { get; set; }
+
        private Binding window_active_binding;
        private bool _is_active;
        public bool is_active {
@@ -62,6 +64,7 @@ private abstract class Games.SidebarView : Gtk.Bin {
 
        construct {
                list_box.set_sort_func (sort_rows);
+               is_collapsed = false;
        }
 
        [GtkCallback]


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