[gxml: 16/16] * cascade property access for example, and transform values for example



commit af719bcfeb9fe3d7978fe746f00bd5688ed82408
Author: Richard Schwarting <aquarichy gmail com>
Date:   Fri Jul 27 11:25:24 2012 +0200

    * cascade property access for example, and transform values for example

 test/XmlSerializableTest.vala |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/test/XmlSerializableTest.vala b/test/XmlSerializableTest.vala
index 469adcc..94939df 100644
--- a/test/XmlSerializableTest.vala
+++ b/test/XmlSerializableTest.vala
@@ -179,7 +179,9 @@ public class SerializableBanana : GLib.Object, GXml.Serializable {
 		return null;
 	}
 
-	public void get_property (GLib.ParamSpec spec, ref GLib.Value value) {
+	public void get_property (GLib.ParamSpec spec, ref GLib.Value str_value) {
+		Value value = Value (typeof (int));
+
 		switch (spec.name) {
 		case "private-field":
 			value.set_int (this.private_field);
@@ -193,7 +195,13 @@ public class SerializableBanana : GLib.Object, GXml.Serializable {
 		case "public-property":
 			value.set_int (this.public_property);
 			break;
+		default:
+			((GLib.Object)this).get_property (spec.name, ref str_value);
+			return;
 		}
+
+		value.transform (ref str_value);
+		return;
 	}
 
 	public void set_property (GLib.ParamSpec spec, GLib.Value value) {
@@ -210,9 +218,12 @@ public class SerializableBanana : GLib.Object, GXml.Serializable {
 		case "public-property":
 			this.public_property = value.get_int ();
 			break;
+		default:
+			((GLib.Object)this).set_property (spec.name, value);
+			return;
 		}
 	}
-		
+
 }
 
 



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