[gnome-games/wip/exalm/libhandy2: 4/4] preferences-window: Use PreferencesSidebar



commit 64cef87fe49859f7306329ad307a5c102c742d96
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Wed Sep 12 15:14:49 2018 +0500

    preferences-window: Use PreferencesSidebar

 data/ui/preferences-window.ui  | 3 +--
 src/ui/preferences-window.vala | 7 ++++---
 2 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/data/ui/preferences-window.ui b/data/ui/preferences-window.ui
index b87914b4..bcaad6d2 100644
--- a/data/ui/preferences-window.ui
+++ b/data/ui/preferences-window.ui
@@ -90,8 +90,7 @@
             <property name="fold">unfolded</property>
             <signal name="notify::fold" handler="on_fold_changed" after="yes"/>
             <child>
-              <object class="GtkStackSidebar" id="sidebar">
-                <property name="margin-top">4</property>
+              <object class="GamesPreferencesSidebar" id="sidebar">
                 <property name="stack">stack</property>
                 <property name="vexpand">True</property>
                 <property name="visible">True</property>
diff --git a/src/ui/preferences-window.vala b/src/ui/preferences-window.vala
index 6b780283..22d1b28c 100644
--- a/src/ui/preferences-window.vala
+++ b/src/ui/preferences-window.vala
@@ -17,7 +17,7 @@ private class Games.PreferencesWindow : Gtk.Window {
        [GtkChild]
        private Hdy.Leaflet content_box;
        [GtkChild]
-       private Gtk.StackSidebar sidebar;
+       private PreferencesSidebar sidebar;
        [GtkChild]
        private Gtk.Stack stack;
 
@@ -66,11 +66,11 @@ private class Games.PreferencesWindow : Gtk.Window {
        private Binding selection_mode_binding;
 
        public PreferencesWindow () {
-               stack.notify["visible-child-name"].connect (visible_child_changed);
+               sidebar.row_selected.connect (row_selected);
                update_ui ();
        }
 
-       private void visible_child_changed () {
+       private void row_selected () {
                content_box.visible_child = stack;
                titlebar_box.visible_child = right_header_bar;
 
@@ -116,6 +116,7 @@ private class Games.PreferencesWindow : Gtk.Window {
 
                left_header_bar.show_close_button = folded;
                back_button.visible = folded;
+               sidebar.folded = folded;
 
                if (folded)
                        stack.transition_type = Gtk.StackTransitionType.NONE;


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