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



commit be1981eaa969a5dd94cd531cf66ce5a9c4f72986
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, 6 insertions(+), 3 deletions(-)
---
diff --git a/data/ui/preferences-window.ui b/data/ui/preferences-window.ui
index cfcfc7b2..6c1c271a 100644
--- a/data/ui/preferences-window.ui
+++ b/data/ui/preferences-window.ui
@@ -91,7 +91,7 @@
                 <property name="orientation">vertical</property>
                 <property name="visible">True</property>
                 <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 ae6b4228..ee43e3db 100644
--- a/src/ui/preferences-window.vala
+++ b/src/ui/preferences-window.vala
@@ -19,6 +19,8 @@ private class Games.PreferencesWindow : Gtk.Window {
        [GtkChild]
        private Gtk.Box sidebar_vbox;
        [GtkChild]
+       private PreferencesSidebar sidebar;
+       [GtkChild]
        private Gtk.Stack stack;
 
        [GtkChild]
@@ -68,11 +70,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;
 
@@ -109,6 +111,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]