[gnome-games/wip/exalm/libhandy2] wip: Add subpage transition



commit 0a815a5e1354a48e0975c8fe5b9e7e2e36a970bb
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Wed Sep 12 13:13:59 2018 +0500

    wip: Add subpage transition
    
    The code is pretty ugly. Maybe I should listen to
    notify::transition-running on the stacks, or something.

 data/ui/preferences-window.ui  |  2 ++
 src/ui/preferences-window.vala | 12 +++++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/data/ui/preferences-window.ui b/data/ui/preferences-window.ui
index e5f50fbb..4c296932 100644
--- a/data/ui/preferences-window.ui
+++ b/data/ui/preferences-window.ui
@@ -10,6 +10,7 @@
     <child type="titlebar">
       <object class="GtkStack" id="titlebar_stack">
         <property name="visible">True</property>
+        <property name="transition-type">GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT_RIGHT</property>
         <child>
           <object class="GtkBox" id="titlebar_box">
             <property name="visible">True</property>
@@ -43,6 +44,7 @@
     <child>
       <object class="GtkStack" id="main_stack">
         <property name="visible">True</property>
+        <property name="transition-type">GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT_RIGHT</property>
         <child>
           <object class="GtkBox" id="content_box">
             <property name="visible">True</property>
diff --git a/src/ui/preferences-window.vala b/src/ui/preferences-window.vala
index 0698d2d6..ff3017b0 100644
--- a/src/ui/preferences-window.vala
+++ b/src/ui/preferences-window.vala
@@ -15,6 +15,8 @@ private class Games.PreferencesWindow : Gtk.Window {
        [GtkChild]
        private Gtk.Stack stack;
 
+       // FIXME: Rework this
+       private PreferencesSubpage subpage_temp;
        private PreferencesSubpage _subpage;
        public PreferencesSubpage subpage {
                get { return _subpage; }
@@ -25,12 +27,14 @@ private class Games.PreferencesWindow : Gtk.Window {
                        if (subpage != null) {
                                main_stack.visible_child = content_box;
                                titlebar_stack.visible_child = titlebar_box;
-
-                               main_stack.remove (subpage);
-                               titlebar_stack.remove (subpage.header_bar);
                        }
 
                        if (value != null) {
+                               if (subpage_temp != null) {
+                                       main_stack.remove (subpage_temp);
+                                       titlebar_stack.remove (subpage_temp.header_bar);
+                               }
+
                                var header_bar = value.header_bar;
 
                                main_stack.add (value);
@@ -38,6 +42,8 @@ private class Games.PreferencesWindow : Gtk.Window {
 
                                titlebar_stack.add (header_bar);
                                titlebar_stack.visible_child = header_bar;
+
+                               subpage_temp = value;
                        }
 
                        _subpage = value;


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