[gnome-boxes] topbar: Now a GtkStack rather than GtkNotebook



commit 98c49c643db674323f91bfa10ea4341e4b1743b6
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Mon Mar 10 15:57:27 2014 +0000

    topbar: Now a GtkStack rather than GtkNotebook

 data/ui/topbar.ui |   25 +++++++++++++++++++++++--
 src/topbar.vala   |   15 ++++++++++++++-
 2 files changed, 37 insertions(+), 3 deletions(-)
---
diff --git a/data/ui/topbar.ui b/data/ui/topbar.ui
index 8555142..fadcc9c 100644
--- a/data/ui/topbar.ui
+++ b/data/ui/topbar.ui
@@ -1,9 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <!-- interface-requires gtk+ 3.9 -->
-  <template class="BoxesTopbar" parent="GtkNotebook">
+  <template class="BoxesTopbar" parent="GtkStack">
     <property name="visible">True</property>
-    <property name="show-tabs">False</property>
+    <property name="transition-type">crossfade</property>
+    <property name="transition-duration">400</property>
 
     <!-- Separate page for each UI state and mode -->
 
@@ -121,6 +122,10 @@
           </packing>
         </child>
       </object>
+
+      <packing>
+        <property name="name">collection</property>
+      </packing>
     </child>
 
     <!-- Collection (selection mode) -->
@@ -204,6 +209,10 @@
           </packing>
         </child>
       </object>
+
+      <packing>
+        <property name="name">selection</property>
+      </packing>
     </child>
 
     <!-- Wizard -->
@@ -296,6 +305,10 @@
           </packing>
         </child>
       </object>
+
+      <packing>
+        <property name="name">wizard</property>
+      </packing>
     </child>
 
     <!-- Properties -->
@@ -331,6 +344,10 @@
           </object>
         </child>
       </object>
+
+      <packing>
+        <property name="name">properties</property>
+      </packing>
     </child>
 
     <!-- Display -->
@@ -340,6 +357,10 @@
         <property name="overlay">False</property>
         <property name="handle-drag">False</property>
       </object>
+
+      <packing>
+        <property name="name">display</property>
+      </packing>
     </child>
   </template>
 
diff --git a/src/topbar.vala b/src/topbar.vala
index 529c0d8..f72c804 100644
--- a/src/topbar.vala
+++ b/src/topbar.vala
@@ -10,7 +10,9 @@ public enum Boxes.TopbarPage {
 }
 
 [GtkTemplate (ui = "/org/gnome/Boxes/ui/topbar.ui")]
-private class Boxes.Topbar: Gtk.Notebook, Boxes.UI {
+private class Boxes.Topbar: Gtk.Stack, Boxes.UI {
+    private const string[] page_names = { "collection", "selection", "wizard", "properties", "display" };
+
     public UIState previous_ui_state { get; protected set; }
     public UIState ui_state { get; protected set; }
 
@@ -66,12 +68,23 @@ private class Boxes.Topbar: Gtk.Notebook, Boxes.UI {
         }
     }
 
+    private TopbarPage _page;
+    public TopbarPage page {
+        get { return _page; }
+        set {
+            _page = value;
+
+            visible_child_name = page_names[value];
+        }
+    }
+
     construct {
         notify["ui-state"].connect (ui_state_changed);
 
         App.app.notify["selected-items"].connect (() => {
             update_selection_label ();
         });
+        transition_type = Gtk.StackTransitionType.CROSSFADE; // FIXME: Why this won't work from .ui file?
     }
 
     public void setup_ui () {


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