[gnome-boxes] remote-machine: Make use of bidirectional prop binding



commit e332daf3423e323fc1c4da07197e0f8cb9755bc8
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Sep 3 20:01:27 2014 +0100

    remote-machine: Make use of bidirectional prop binding
    
    We were (manually) setting the name of the underlying source on change
    of machine name while having a unidirectional binding from source's name
    to machine name. This creates an endless loop and hangs Boxes when user
    modifies a remote machine's name.
    
    Lets just create a bidirectional binding and let GObject take care of
    keeping name of both objects in sync.

 src/remote-machine.vala |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)
---
diff --git a/src/remote-machine.vala b/src/remote-machine.vala
index a395451..278f505 100644
--- a/src/remote-machine.vala
+++ b/src/remote-machine.vala
@@ -14,12 +14,10 @@ private class Boxes.RemoteMachine: Boxes.Machine, Boxes.IPropertiesProvider {
         state = MachineState.RUNNING;
 
         create_display_config ();
-        source.bind_property ("name", this, "name", BindingFlags.DEFAULT);
+        source.bind_property ("name", this, "name", BindingFlags.BIDIRECTIONAL);
         config.access_last_time = get_real_time ();
 
         load_screenshot ();
-
-        notify["name"].connect (save_name);
     }
 
     private Display? create_display () throws Boxes.Error {
@@ -100,8 +98,4 @@ private class Boxes.RemoteMachine: Boxes.Machine, Boxes.IPropertiesProvider {
     // FIXME: Implement this. We don't currently need it because we don't set any properties here that 
requires a
     //        restart and this method is currently used for that purpose only.
     public override void restart () {}
-
-    private void save_name () {
-        source.name = name;
-    }
 }


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