[gnome-boxes] machine: Only bind 'status' to 'name' in DISPLAY state



commit 660188baf1ae0a07323eb0b162be7bbd2359ec5e
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Fri Aug 28 16:44:05 2015 +0100

    machine: Only bind 'status' to 'name' in DISPLAY state
    
    https://bugzilla.gnome.org/show_bug.cgi?id=753888

 src/machine.vala |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/machine.vala b/src/machine.vala
index 4a26276..6410777 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -255,10 +255,6 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
                 set_screenshot_enable (true);
         });
 
-        notify["name"].connect (() => {
-            status = this.name;
-        });
-
         create_display_config (uuid);
 
         // This needs to be set after the 'config' prop has been set.
@@ -564,7 +560,15 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
         }
     }
 
+    private GLib.Binding? name_status_bind;
+
     private void ui_state_changed () {
+        if (name_status_bind != null) {
+            name_status_bind.unbind ();
+            name_status_bind = null;
+            status = null;
+        }
+
         switch (ui_state) {
         case UIState.CREDS:
             window.below_bin.set_visible_child_name ("connecting-page");
@@ -574,6 +578,7 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
         case Boxes.UIState.DISPLAY:
             if (previous_ui_state == UIState.PROPERTIES)
                 window.below_bin.set_visible_child_name ("display-page");
+            name_status_bind = bind_property ("name", this, "status", BindingFlags.SYNC_CREATE);
 
             break;
 


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