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



commit 45ad34a1a59a78d6ac1957190e031f3295e18320
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 5a56af03..bdd6496e 100644
--- a/data/ui/preferences-window.ui
+++ b/data/ui/preferences-window.ui
@@ -92,7 +92,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 be56ec79..12ab5667 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]
@@ -64,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;
 
@@ -114,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]