6 [DBus (name = "org.example.Test")]
7 interface Test : Object {
8 public abstract HashTable<string, HashTable<string, Variant>> test_nested_dict () throws IOError;
13 Test test = Bus.get_proxy_sync (BusType.SESSION, "org.example.Test", "/org/example/test");
15 HashTable<string, HashTable<string, Variant>> dict = test.test_nested_dict ();
16 assert (dict.size () == 1);
17 HashTable<string, Variant> nested_dict = dict.lookup ("hello");
18 assert (nested_dict != null);
19 Variant v = nested_dict.lookup ("hello");
21 string[] s = (string[]) v;
22 assert (s.length == 1 && s[0] == "hello");
27 [DBus (name = "org.example.Test")]
29 public HashTable<string, HashTable<string, Variant>> test_nested_dict () {
30 string[] s = { "hello" };
31 HashTable<string, Variant> nested_dict = new HashTable<string, Variant> (str_hash, null);
32 nested_dict.insert ("hello", s);
33 HashTable<string, HashTable<string, Variant>> dict = new HashTable<string, HashTable<string, Variant>> (str_hash, null);
34 dict.insert ("hello", nested_dict);
41 void client_exit (Pid pid, int status) {
42 // client finished, terminate server
48 var conn = Bus.get_sync (BusType.SESSION);
49 conn.register_object ("/org/example/test", new Test ());
51 // try to register service in session bus
52 var request_result = conn.call_sync ("org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", "RequestName",
53 new Variant ("(su)", "org.example.Test", 0x4), null, 0, -1);
54 assert ((uint) request_result.get_child_value (0) == 1);
56 // server ready, spawn client
58 Process.spawn_async (null, { "test", "/dbus/bug782719/client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
59 ChildWatch.add (client_pid, client_exit);
61 main_loop = new MainLoop ();