[gnome-games/wip/exalm/libhandy2: 6/6] ui: Use PreferencesSidebar in preferences window



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

    ui: Use PreferencesSidebar in preferences window

 data/ui/preferences-window.ui  | 2 +-
 src/ui/preferences-window.vala | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/data/ui/preferences-window.ui b/data/ui/preferences-window.ui
index b87914b4..8538cfdd 100644
--- a/data/ui/preferences-window.ui
+++ b/data/ui/preferences-window.ui
@@ -90,7 +90,7 @@
             <property name="fold">unfolded</property>
             <signal name="notify::fold" handler="on_fold_changed" after="yes"/>
             <child>
-              <object class="GtkStackSidebar" id="sidebar">
+              <object class="GamesPreferencesSidebar" id="sidebar">
                 <property name="margin-top">4</property>
                 <property name="stack">stack</property>
                 <property name="vexpand">True</property>
diff --git a/src/ui/preferences-window.vala b/src/ui/preferences-window.vala
index e0034b14..345a6c30 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;
 
@@ -67,11 +67,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;
 
@@ -117,6 +117,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]