[gnome-boxes] wizard,properties: Free them of actors



commit 7c27ee55b6908197cbddb7668bbecb0db6847716
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Feb 19 14:05:27 2014 +0000

    wizard,properties: Free them of actors
    
    We still use an actor to contain the Gtk.Stack they are now in but even
    that will be removed in a following patch.

 data/gtk-style.css  |   10 ++++++++++
 data/ui/wizard.ui   |    3 +--
 src/app.vala        |   26 +++++++++++++++++++-------
 src/properties.vala |   22 +++++++++++-----------
 src/wizard.vala     |   15 +++++----------
 5 files changed, 46 insertions(+), 30 deletions(-)
---
diff --git a/data/gtk-style.css b/data/gtk-style.css
index 7d8fe30..3e9718a 100644
--- a/data/gtk-style.css
+++ b/data/gtk-style.css
@@ -66,6 +66,11 @@ BoxesMiniGraph {
     font-weight: bold;
 }
 
+.wizard {
+    background-image: url("icons/boxes-dark.png");
+    border-image-repeat: stretch;
+}
+
 .boxes-wizard-label {
     color: #d8d8d8;
 }
@@ -187,3 +192,8 @@ BoxesMiniGraph {
 .boxes-empty-details-label {
     color: #555753;
 }
+
+.properties {
+    background-image: url("icons/boxes-dark.png");
+    border-image-repeat: stretch;
+}
diff --git a/data/ui/wizard.ui b/data/ui/wizard.ui
index 79911d7..43ff3a1 100644
--- a/data/ui/wizard.ui
+++ b/data/ui/wizard.ui
@@ -4,9 +4,8 @@
   <template class="BoxesWizard" parent="GtkNotebook">
     <property name="visible">True</property>
     <property name="show-tabs">False</property>
-    <property name="margin">15</property>
-    <property name="width-request">500</property>
     <style>
+      <class name="wizard"/>
       <class name="boxes-bg"/>
     </style>
 
diff --git a/src/app.vala b/src/app.vala
index 5b2da86..5b8baf1 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -100,6 +100,8 @@ private class Boxes.App: GLib.Object, Boxes.UI {
     public string? uri { get; set; }
     public Collection collection;
     public CollectionFilter filter;
+    private Gtk.Stack content_bin;
+    private Clutter.Actor content_bin_actor;
 
     private bool is_ready;
     public signal void ready ();
@@ -618,21 +620,20 @@ private class Boxes.App: GLib.Object, Boxes.UI {
 
         hbox_actor.add_child (sidebar.actor);
 
-        var content_bin_actor = new Clutter.Actor ();
-        content_bin_actor.name = "content-bin";
+        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;
-        var content_bin = new Clutter.BinLayout (Clutter.BinAlignment.START,
-                                                 Clutter.BinAlignment.START);
-        content_bin_actor.set_layout_manager (content_bin);
         hbox_actor.add_child (content_bin_actor);
 
         below_bin_actor.add_child (notificationbar.actor);
 
-        content_bin_actor.add (wizard.actor);
-        content_bin_actor.add (properties.actor);
         below_bin_actor.insert_child_below (empty_boxes.actor, notificationbar.actor);
 
         properties.actor.hide ();
@@ -659,6 +660,8 @@ 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);
+
         switch (ui_state) {
         case UIState.COLLECTION:
             topbar.status = null;
@@ -678,8 +681,17 @@ private class Boxes.App: GLib.Object, Boxes.UI {
             break;
 
         case UIState.CREDS:
+
+            break;
+
         case UIState.WIZARD:
+            content_bin.visible_child = wizard;
+
+            break;
+
         case UIState.PROPERTIES:
+            content_bin.visible_child = properties;
+
             break;
 
         case UIState.DISPLAY:
diff --git a/src/properties.vala b/src/properties.vala
index 639eec8..7cc39c3 100644
--- a/src/properties.vala
+++ b/src/properties.vala
@@ -11,11 +11,19 @@ private enum Boxes.PropertiesPage {
 }
 
 private class Boxes.Properties: Gtk.Notebook, 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;
+    private Clutter.Actor gtk_actor;
     private ulong stats_id;
     private bool restore_fullscreen;
 
@@ -159,17 +167,9 @@ private class Boxes.Properties: Gtk.Notebook, Boxes.UI {
 
     private void setup_ui () {
         show_tabs = false;
+        get_style_context ().add_class ("properties");
         get_style_context ().add_class ("boxes-bg");
 
-        gtk_actor = new GtkClutter.Actor.with_contents (this);
-        gtk_actor.get_widget ().get_style_context ().add_class ("boxes-bg");
-        gtk_actor.name = "properties";
-        gtk_actor.opacity = 0;
-        gtk_actor.x_align = Clutter.ActorAlign.FILL;
-        gtk_actor.y_align = Clutter.ActorAlign.FILL;
-        gtk_actor.x_expand = true;
-        gtk_actor.y_expand = true;
-
         show_all ();
     }
 
diff --git a/src/wizard.vala b/src/wizard.vala
index e91ca8e..2696b75 100644
--- a/src/wizard.vala
+++ b/src/wizard.vala
@@ -12,12 +12,16 @@ private enum Boxes.WizardPage {
 
 [GtkTemplate (ui = "/org/gnome/Boxes/ui/wizard.ui")]
 private class Boxes.Wizard: Gtk.Notebook, Boxes.UI {
+    // See FIXME on Topbar class
     public Clutter.Actor actor {
         get {
+            if (gtk_actor == null)
+                gtk_actor = new Clutter.Actor ();
             return gtk_actor;
         }
     }
-    private GtkClutter.Actor gtk_actor;
+
+    private Clutter.Actor gtk_actor;
     public UIState previous_ui_state { get; protected set; }
     public UIState ui_state { get; protected set; }
 
@@ -527,15 +531,6 @@ private class Boxes.Wizard: Gtk.Notebook, Boxes.UI {
     }
 
     private void setup_ui () {
-        gtk_actor = new GtkClutter.Actor.with_contents (this);
-        gtk_actor.get_widget ().get_style_context ().add_class ("boxes-bg");
-        gtk_actor.name = "wizard";
-        gtk_actor.opacity = 0;
-        gtk_actor.x_align = Clutter.ActorAlign.FILL;
-        gtk_actor.y_align = Clutter.ActorAlign.FILL;
-        gtk_actor.x_expand = true;
-        gtk_actor.y_expand = true;
-
         cancel_button = App.app.topbar.wizard_cancel_btn;
         cancel_button.clicked.connect (() => {
             destroy_machine ();


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