6 [DBus (name = "org.example.Test")]
7 interface Test : Object {
8 public signal void foo (int i);
10 public abstract void do_foo (int i) throws IOError;
17 Test test = Bus.get_proxy_sync (BusType.SESSION, "org.example.Test", "/org/example/test");
19 test.foo.connect ((i) => {
26 main_loop = new MainLoop ();
32 [DBus (name = "org.example.Test")]
34 public signal void foo (int i);
36 public void do_foo (int i) {
43 void client_exit (Pid pid, int status) {
44 // client finished, terminate server
50 var conn = Bus.get_sync (BusType.SESSION);
51 conn.register_object ("/org/example/test", new Test ());
53 // try to register service in session bus
54 var request_result = conn.call_sync ("org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", "RequestName",
55 new Variant ("(su)", "org.example.Test", 0x4), null, 0, -1);
56 assert ((uint) request_result.get_child_value (0) == 1);
58 // server ready, spawn client
60 Process.spawn_async (null, { "test", "/dbus/signals/client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
61 ChildWatch.add (client_pid, client_exit);
63 main_loop = new MainLoop ();