summaryrefslogtreecommitdiff
path: root/contrib/json-object.vala
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@openedhand.com>2007-12-25 11:55:36 +0000
committerEmmanuele Bassi <ebassi@openedhand.com>2007-12-25 11:55:36 +0000
commit61a6a144a2182946be4fb975d05e1c26d814c323 (patch)
tree756cad3658d8d4946219244bb7bc45a306d1300f /contrib/json-object.vala
parent8ec0c93715f6f43e4829a6f3ac534f9ec05e0363 (diff)
downloadjson-glib-61a6a144a2182946be4fb975d05e1c26d814c323.tar.gz
Some miscellaneous fixes to the Vala bindings
Expose the properties as members and remove the accessor methods in case it's obvious that they are just function proxies. Also, start binding the basic GObject API, even though no serializable support is ready, yet.
Diffstat (limited to 'contrib/json-object.vala')
-rw-r--r--contrib/json-object.vala10
1 files changed, 8 insertions, 2 deletions
diff --git a/contrib/json-object.vala b/contrib/json-object.vala
index a8058f5..993381d 100644
--- a/contrib/json-object.vala
+++ b/contrib/json-object.vala
@@ -25,7 +25,8 @@ public class Sample : GLib.Object {
root.set_object (obj);
var generator = new Json.Generator ();
- generator.set_root (root);
+ generator.pretty = true;
+ generator.root = root;
return generator.to_data ();
}
@@ -33,7 +34,12 @@ public class Sample : GLib.Object {
static int main (string[] args) {
var sample = new Sample ();
- stdout.printf ("var sample = %s;\n", sample.to_json ());
+ stdout.printf ("[manual] var sample = %s;\n",
+ sample.to_json ());
+
+ var buf = Json.serialize_gobject (sample);
+ stdout.printf ("[automatic] var sample = %s;\n",
+ buf);
return 0;
}