[gnome-boxes/wip/less-actors2: 3/7] app: Keep props/wizard view in a Gtk.Box



commit 16ea532fa7ecfaac7bd68103a0690560a46b171c
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Feb 19 15:39:42 2014 +0000

    app: Keep props/wizard view in a Gtk.Box
    
    Instead of putting sidebar and content_bin (container of wizard and
    properties) in a clutter actor and relying on BoxLayout, lets just put
    the whole thing in a Gtk.Box.

 data/ui/sidebar.ui |    2 ++
 src/app.vala       |   22 +++++++++-------------
 src/sidebar.vala   |   16 +++++++++-------
 3 files changed, 20 insertions(+), 20 deletions(-)
---
diff --git a/data/ui/sidebar.ui b/data/ui/sidebar.ui
index 878c482..459f3f6 100644
--- a/data/ui/sidebar.ui
+++ b/data/ui/sidebar.ui
@@ -7,6 +7,8 @@
     <property name="width-request">100</property>
     <property name="transition-type">slide-right</property>
     <property name="vexpand">True</property>
+    <property name="hexpand">False</property>
+    <property name="halign">start</property>
     <style>
       <class name="sidebar"/>
     </style>
diff --git a/src/app.vala b/src/app.vala
index 5b8baf1..170ee7b 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -101,7 +101,7 @@ private class Boxes.App: GLib.Object, Boxes.UI {
     public Collection collection;
     public CollectionFilter filter;
     private Gtk.Stack content_bin;
-    private Clutter.Actor content_bin_actor;
+    private Clutter.Actor hbox_actor;
 
     private bool is_ready;
     public signal void ready ();
@@ -607,10 +607,9 @@ private class Boxes.App: GLib.Object, Boxes.UI {
 
         below_bin_actor.add_child (view.actor);
 
-        var hbox_actor = new Clutter.Actor ();
+        var hbox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
+        hbox_actor = new GtkClutter.Actor.with_contents (hbox);
         hbox_actor.name = "top-hbox";
-        var hbox = new Clutter.BoxLayout ();
-        hbox_actor.set_layout_manager (hbox);
         hbox_actor.x_align = Clutter.ActorAlign.FILL;
         hbox_actor.y_align = Clutter.ActorAlign.FILL;
         hbox_actor.x_expand = true;
@@ -618,19 +617,16 @@ private class Boxes.App: GLib.Object, Boxes.UI {
 
         below_bin_actor.add_child (hbox_actor);
 
-        hbox_actor.add_child (sidebar.actor);
-
         content_bin = new Gtk.Stack ();
         content_bin.vexpand = true;
         content_bin.hexpand = true;
         content_bin.add (wizard);
         content_bin.add (properties);
-        content_bin_actor  = new GtkClutter.Actor.with_contents (content_bin);
-        content_bin_actor.x_align = Clutter.ActorAlign.FILL;
-        content_bin_actor.y_align = Clutter.ActorAlign.FILL;
-        content_bin_actor.x_expand = true;
-        content_bin_actor.y_expand = true;
-        hbox_actor.add_child (content_bin_actor);
+
+        hbox.add (sidebar);
+        hbox.add (content_bin);
+        hbox.show_all ();
+        hbox_actor.hide ();
 
         below_bin_actor.add_child (notificationbar.actor);
 
@@ -660,7 +656,7 @@ private class Boxes.App: GLib.Object, Boxes.UI {
         if (ui_state != UIState.COLLECTION)
             searchbar.visible = false;
 
-        content_bin_actor.visible = (ui_state == UIState.WIZARD || ui_state == UIState.PROPERTIES);
+        hbox_actor.visible = (ui_state == UIState.WIZARD || ui_state == UIState.PROPERTIES);
 
         switch (ui_state) {
         case UIState.COLLECTION:
diff --git a/src/sidebar.vala b/src/sidebar.vala
index b2a3363..2701ed6 100644
--- a/src/sidebar.vala
+++ b/src/sidebar.vala
@@ -11,11 +11,18 @@ private enum Boxes.SidebarPage {
 
 [GtkTemplate (ui = "/org/gnome/Boxes/ui/sidebar.ui")]
 private class Boxes.Sidebar: Gtk.Revealer, Boxes.UI {
-    public Clutter.Actor actor { get { return gtk_actor; } }
+    // See FIXME on Topbar class
+    public Clutter.Actor actor {
+        get {
+            if (gtk_actor == null)
+                gtk_actor = new Clutter.Actor ();
+            return gtk_actor;
+        }
+    }
     public UIState previous_ui_state { get; protected set; }
     public UIState ui_state { get; protected set; }
 
-    private GtkClutter.Actor gtk_actor; // the sidebar box
+    private Clutter.Actor gtk_actor; // the sidebar box
 
     [GtkChild]
     private Gtk.Notebook notebook;
@@ -95,11 +102,6 @@ private class Boxes.Sidebar: Gtk.Revealer, Boxes.UI {
 
     private void setup_sidebar () {
         props_model_filter.set_visible_column (1);
-
-        gtk_actor = new GtkClutter.Actor.with_contents (this);
-        gtk_actor.get_widget ().get_style_context ().add_class ("boxes-bg");
-        gtk_actor.name = "sidebar";
-        gtk_actor.y_expand = true;
     }
 
     [GtkCallback]


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