[gnome-boxes] Show display in properties page



commit 503a291dd32bfbe92c444a3a4601abda39d3d270
Author: Marc-Andrà Lureau <marcandre lureau gmail com>
Date:   Wed Nov 2 15:31:06 2011 +0100

    Show display in properties page

 src/collection-view.vala |    1 +
 src/display-page.vala    |    4 ++-
 src/machine.vala         |   49 +++++++++++++++++++++++++++++++++++++++------
 src/spice-display.vala   |    2 +
 4 files changed, 48 insertions(+), 8 deletions(-)
---
diff --git a/src/collection-view.vala b/src/collection-view.vala
index f724aaa..1560e33 100644
--- a/src/collection-view.vala
+++ b/src/collection-view.vala
@@ -90,6 +90,7 @@ private class Boxes.CollectionView: Boxes.UI {
             over_boxes.pack (ui_state == UIState.WIZARD ? app.wizard.actor : app.properties.actor);
             app.wizard.actor.add_constraint (new Clutter.BindConstraint (over_boxes, BindCoordinate.SIZE, 0));
             actor_add (over_boxes, app.stage);
+            app.current_item.ui_state = ui_state;
             break;
 
         default:
diff --git a/src/display-page.vala b/src/display-page.vala
index a57ef5d..0970c5c 100644
--- a/src/display-page.vala
+++ b/src/display-page.vala
@@ -130,7 +130,7 @@ private class Boxes.DisplayPage: GLib.Object {
         show ();
     }
 
-    public void remove_display () {
+    public Widget? remove_display () {
         var display = event_box.get_child ();
 
         if (display_id != 0) {
@@ -144,6 +144,8 @@ private class Boxes.DisplayPage: GLib.Object {
 
         if (display != null)
             event_box.remove (display);
+
+        return display;
     }
 
 }
diff --git a/src/machine.vala b/src/machine.vala
index 229ebb8..ff50035 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -17,7 +17,7 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IProperties {
     private uint screenshot_id;
 
     private Display? _display;
-    protected Display? display {
+    public Display? display {
         get { return _display; }
         set {
             if (_display != null) {
@@ -224,7 +224,8 @@ private class Boxes.MachineActor: Boxes.UI {
     public Clutter.Box box;
 
     private GtkClutter.Texture screenshot;
-    public GtkClutter.Actor gtk_vbox;
+    private GtkClutter.Actor gtk_vbox;
+    private GtkClutter.Actor? display;
     private Gtk.Label label;
     private Gtk.VBox vbox; // and the vbox under it
     private Gtk.Entry password_entry;
@@ -298,6 +299,10 @@ private class Boxes.MachineActor: Boxes.UI {
     }
 
     public override void ui_state_changed () {
+        int width, height;
+
+        machine.app.window.get_size (out width, out height);
+
         switch (ui_state) {
         case UIState.CREDS:
             scale_screenshot (2.0f);
@@ -306,19 +311,32 @@ private class Boxes.MachineActor: Boxes.UI {
 
         case UIState.DISPLAY:
             if (previous_ui_state == UIState.CREDS) {
-                int width, height;
-
                 password_entry.hide ();
                 label.hide ();
-                machine.app.window.get_size (out width, out height);
                 screenshot.animate (Clutter.AnimationMode.LINEAR, Boxes.App.duration,
                                     "width", (float) width,
                                     "height", (float) height);
                 actor.animate (Clutter.AnimationMode.LINEAR, Boxes.App.duration,
                                "x", 0.0f,
                                "y", 0.0f);
-            } else
-                machine.app.display_page.show ();
+            } else {
+                if (display != null) {
+                    var anim = display.animate (Clutter.AnimationMode.LINEAR, Boxes.App.duration,
+                                                "x", 0.0f,
+                                                "y", 0.0f,
+                                                "width", (float) width,
+                                                "height", (float) height);
+                    anim.completed.connect (() => {
+                        actor_remove (display);
+                        var widget = display.contents;
+                        display.contents = null;
+                        display = null;
+                        // FIXME: enable grabs
+                        machine.app.display_page.show_display (machine, widget);
+                    });
+                } else
+                    machine.app.display_page.show ();
+            }
 
             break;
 
@@ -329,6 +347,23 @@ private class Boxes.MachineActor: Boxes.UI {
             label.show ();
             break;
 
+        case UIState.PROPERTIES:
+            var widget = machine.app.display_page.remove_display ();
+            // FIXME: disable grabs
+            display = new GtkClutter.Actor.with_contents (widget);
+            display.x = 0.0f;
+            display.y = 0.0f;
+            display.width = (float) width;
+            display.height = (float) height;
+            actor_add (display, machine.app.stage);
+
+            display.animate (Clutter.AnimationMode.LINEAR, Boxes.App.duration,
+                             "x", 10.0f,
+                             "y", 70.0f,
+                             "width", 190.0f,
+                             "height", 130.0f);
+            break;
+
         default:
             message ("Unhandled UI state " + ui_state.to_string ());
             break;
diff --git a/src/spice-display.vala b/src/spice-display.vala
index 822f0e6..c96f9d0 100644
--- a/src/spice-display.vala
+++ b/src/spice-display.vala
@@ -38,6 +38,8 @@ private class Boxes.SpiceDisplay: Boxes.Display, Boxes.IProperties {
 
             display.resize_guest = true;
             display.scaling = true;
+
+            displays.replace (n, display);
         }
 
         return display;



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