[gnome-boxes/wip/wizard-n-props-in-dialog2: 10/12] properties: Turn it into Gtk.Notebook from Gtk.Stack



commit 407dc8919caa132565450c92b2399967565851d9
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Sun Nov 23 16:04:39 2014 +0000

    properties: Turn it into Gtk.Notebook from Gtk.Stack
    
    According to the new UI mockup, we need it to be a notebook so that
    we have page switching controls before we drop the sidebar.

 src/properties.vala |   29 +++++++----------------------
 1 files changed, 7 insertions(+), 22 deletions(-)
---
diff --git a/src/properties.vala b/src/properties.vala
index bb81ac8..0d60531 100644
--- a/src/properties.vala
+++ b/src/properties.vala
@@ -10,8 +10,8 @@ private enum Boxes.PropertiesPage {
     LAST,
 }
 
-private class Boxes.Properties: Gtk.Stack, Boxes.UI {
-    private const string[] page_names = { "general", "system", "devices", "snapshots" };
+private class Boxes.Properties: Gtk.Notebook, Boxes.UI {
+    private const string[] page_titles = { N_("General"), N_("System"), N_("Devices"), N_("Snapshots") };
 
     public UIState previous_ui_state { get; protected set; }
     public UIState ui_state { get; protected set; }
@@ -22,16 +22,6 @@ private class Boxes.Properties: Gtk.Stack, Boxes.UI {
     private ulong stats_id;
     private bool restore_fullscreen;
 
-    private PropertiesPage _page;
-    public PropertiesPage page {
-        get { return _page; }
-        set {
-            _page = value;
-
-            visible_child_name = page_names[value];
-        }
-    }
-
     private class PageWidget: Gtk.Box {
         public bool empty;
 
@@ -148,7 +138,8 @@ private class Boxes.Properties: Gtk.Stack, Boxes.UI {
 
         for (var i = 0; i < PropertiesPage.LAST; i++) {
             var page = new PageWidget (i, machine);
-            add_named (page, page_names[i]);
+            var label = new Gtk.Label (page_titles[i]);
+            insert_page (page, label, i);
             set_data<PageWidget> (@"boxes-property-$i", page);
 
             page.refresh_properties.connect (() => {
@@ -162,25 +153,19 @@ private class Boxes.Properties: Gtk.Stack, Boxes.UI {
             list_append (sidebar.listmodel, page.name, !page.empty);
         }
 
-        PropertiesPage current_page;
-
         if (libvirt_machine != null)
-            current_page = (previous_ui_state == UIState.WIZARD) ? PropertiesPage.SYSTEM : 
PropertiesPage.GENERAL;
+            page = (previous_ui_state == UIState.WIZARD) ? PropertiesPage.SYSTEM : PropertiesPage.GENERAL;
         else
-            current_page = PropertiesPage.GENERAL;
+            page = PropertiesPage.GENERAL;
 
-        var path = new Gtk.TreePath.from_indices (current_page);
+        var path = new Gtk.TreePath.from_indices (page);
         sidebar.selection.select_path (path);
-        visible_child_name = page_names[current_page];
     }
 
     public void setup_ui (AppWindow window, PropertiesDialog dialog) {
         this.window = window;
         this.sidebar = dialog.sidebar;
 
-        transition_type = Gtk.StackTransitionType.SLIDE_UP_DOWN;
-        transition_duration = 400;
-
         show_all ();
     }
 


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