10 public FooStruct (int i, string s) {
16 [DBus (name = "org.example.Test")]
17 interface Test : Object {
18 public abstract FooStruct test_property { owned get; set; }
20 public abstract FooStruct test_struct (FooStruct f, out FooStruct g) throws IOError;
25 Test test = Bus.get_proxy_sync (BusType.SESSION, "org.example.Test", "/org/example/test", DBusProxyFlags.DO_NOT_LOAD_PROPERTIES);
28 f = FooStruct (42, "hello");
29 h = test.test_struct (f, out g);
31 assert (g.s == "world");
33 assert (h.s == "vala");
35 test.test_property = f;
36 g = test.test_property;
38 assert (g.s == "hello");
47 public FooStruct (int i, string s) {
53 [DBus (name = "org.example.Test")]
55 public FooStruct test_property { owned get; set; }
57 public FooStruct test_struct (FooStruct f, out FooStruct g) {
59 assert (f.s == "hello");
60 g = FooStruct (23, "world");
61 return FooStruct (11, "vala");
67 void client_exit (Pid pid, int status) {
68 // client finished, terminate server
74 var conn = Bus.get_sync (BusType.SESSION);
75 conn.register_object ("/org/example/test", new Test ());
77 // try to register service in session bus
78 var request_result = conn.call_sync ("org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", "RequestName",
79 new Variant ("(su)", "org.example.Test", 0x4), null, 0, -1);
80 assert ((uint) request_result.get_child_value (0) == 1);
82 // server ready, spawn client
84 Process.spawn_async (null, { "test", "/dbus/structs/client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
85 ChildWatch.add (client_pid, client_exit);
87 main_loop = new MainLoop ();