[gnome-boxes] Track screenshot position as window size changes



commit 2a1c9e0c74e2476e2c96e0e18acd81d040e49cc3
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Jun 7 18:28:57 2012 +0200

    Track screenshot position as window size changes
    
    This handles the position of the screenshot thumbnail changing.
    It requires latest clutter version to work. Also, it animates
    when changing the position, but we can't fix this until we
    get per-meta animation properties in clutter.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=677274

 src/machine.vala |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/machine.vala b/src/machine.vala
index 2747808..e15a6bb 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -265,8 +265,11 @@ private class Boxes.MachineActor: Boxes.UI {
     private Gtk.VBox vbox; // and the vbox under it
     private Gtk.Entry password_entry;
     private Machine machine;
+    ulong track_screenshot_id = 0;
 
     ~MachineActor() {
+        if (track_screenshot_id != 0)
+            machine.app.properties.screenshot_placeholder.disconnect (track_screenshot_id);
     }
 
     public MachineActor (Machine machine) {
@@ -376,6 +379,9 @@ private class Boxes.MachineActor: Boxes.UI {
                 if (display != null) {
                     // zoom in, back from properties
 
+                    machine.app.properties.screenshot_placeholder.disconnect (track_screenshot_id);
+                    track_screenshot_id = 0;
+
                     machine.app.overlay_bin.set_alignment (display,
                                                            Clutter.BinAlignment.FILL,
                                                            Clutter.BinAlignment.FILL);
@@ -420,9 +426,7 @@ private class Boxes.MachineActor: Boxes.UI {
             if (machine.app.fullscreen)
                 machine.app.topbar.actor.hide ();
 
-            ulong id = 0;
-            id = machine.app.properties.screenshot_placeholder.size_allocate.connect ( (alloc) => {
-                machine.app.properties.screenshot_placeholder.disconnect (id);
+            track_screenshot_id = machine.app.properties.screenshot_placeholder.size_allocate.connect ( (alloc) => {
                 Idle.add_full (Priority.HIGH, () => {
                     machine.app.topbar.actor.show ();
                     machine.app.overlay_bin.set_alignment (display,



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