[gnome-boxes] Pass the Property in the changed callback



commit e238156af4607cbf47b954b4fb21a6dadfa768b0
Author: Marc-Andrà Lureau <marcandre lureau gmail com>
Date:   Thu Jul 19 15:18:32 2012 +0200

    Pass the Property in the changed callback
    
    So that the Property state can be modified.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=680293

 src/i-properties-provider.vala |    8 ++++----
 src/libvirt-machine.vala       |    6 +++---
 src/remote-machine.vala        |    2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/src/i-properties-provider.vala b/src/i-properties-provider.vala
index 7fe6bcc..73287a4 100644
--- a/src/i-properties-provider.vala
+++ b/src/i-properties-provider.vala
@@ -11,8 +11,8 @@ private class Boxes.Property: GLib.Object {
     }
 }
 
-public delegate void PropertyStringChanged (string value) throws Boxes.Error;
-public delegate void PropertySizeChanged (uint64 value) throws Boxes.Error;
+private delegate void PropertyStringChanged (Boxes.Property property, string value) throws Boxes.Error;
+private delegate void PropertySizeChanged (Boxes.Property property, uint64 value) throws Boxes.Error;
 
 private interface Boxes.IPropertiesProvider: GLib.Object {
     public abstract List<Boxes.Property> get_properties (Boxes.PropertiesPage page);
@@ -36,7 +36,7 @@ private interface Boxes.IPropertiesProvider: GLib.Object {
         var property = add_property (ref list, name, entry);
         entry.editing_done.connect (() => {
             try {
-                changed (entry.text);
+                changed (property, entry.text);
             } catch (Boxes.Error.INVALID error) {
                 entry.start_editing ();
             } catch (Boxes.Error error) {
@@ -69,7 +69,7 @@ private interface Boxes.IPropertiesProvider: GLib.Object {
         if (changed != null)
             scale.value_changed.connect (() => {
                 try {
-                    changed ((uint64) scale.get_value ());
+                    changed (property, (uint64) scale.get_value ());
                 } catch (Boxes.Error error) {
                     warning (error.message);
                 }
diff --git a/src/libvirt-machine.vala b/src/libvirt-machine.vala
index c6e0d49..b4065ae 100644
--- a/src/libvirt-machine.vala
+++ b/src/libvirt-machine.vala
@@ -293,7 +293,7 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
 
         switch (page) {
         case PropertiesPage.LOGIN:
-            add_string_property (ref list, _("Name"), name, (name) => {
+            add_string_property (ref list, _("Name"), name, (property, name) => {
                 try_change_name (name);
             });
             add_string_property (ref list, _("Virtualizer"), source.uri);
@@ -479,7 +479,7 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
         } catch (GLib.Error error) {}
     }
 
-    private void on_ram_changed (uint64 value) {
+    private void on_ram_changed (Boxes.Property property, uint64 value) {
         // Ensure that we don't end-up changing RAM like a 1000 times a second while user moves the slider..
         if (ram_update_timeout != 0)
             Source.remove (ram_update_timeout);
@@ -541,7 +541,7 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
         }
     }
 
-    private void on_storage_changed (uint64 value) {
+    private void on_storage_changed (Boxes.Property property, uint64 value) {
         // Ensure that we don't end-up changing storage like a 1000 times a second while user moves the slider..
         if (storage_update_timeout != 0)
             Source.remove (storage_update_timeout);
diff --git a/src/remote-machine.vala b/src/remote-machine.vala
index 1bd3e53..0d9ab23 100644
--- a/src/remote-machine.vala
+++ b/src/remote-machine.vala
@@ -36,7 +36,7 @@ private class Boxes.RemoteMachine: Boxes.Machine, Boxes.IPropertiesProvider {
 
         switch (page) {
         case PropertiesPage.LOGIN:
-            add_string_property (ref list, _("Name"), source.name, (name) => {
+            add_string_property (ref list, _("Name"), source.name, (property, name) => {
                 source.name = name;
             });
             add_string_property (ref list, _("URI"), source.uri);



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