[gnome-chess/chess-telepathy-networking-support-664946-communicate: 8/15] Modify gdbus-client test to asynchronously fetch objects
- From: Chandni Verma <vchandni src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-chess/chess-telepathy-networking-support-664946-communicate: 8/15] Modify gdbus-client test to asynchronously fetch objects
- Date: Sun, 16 Jun 2013 15:51:38 +0000 (UTC)
commit 17c6502039a6a9ed931681f920cdd52ab29c4773
Author: Chandni Verma <chandniverma2112 gmail com>
Date: Fri Dec 28 08:28:25 2012 +0530
Modify gdbus-client test to asynchronously fetch objects
tests/test-demo-gdbus-client.vala | 46 ++++++++++++++++++++-----------------
1 files changed, 25 insertions(+), 21 deletions(-)
---
diff --git a/tests/test-demo-gdbus-client.vala b/tests/test-demo-gdbus-client.vala
index 354806f..318ea34 100644
--- a/tests/test-demo-gdbus-client.vala
+++ b/tests/test-demo-gdbus-client.vala
@@ -16,28 +16,32 @@ void main () {
/* Important: keep demo variable out of try/catch scope not lose signals! */
Demo demo = null;
- try {
- demo = Bus.get_proxy_sync (BusType.SESSION, "org.example.Demo",
- "/org/example/demo");
+ Bus.get_proxy<Demo> (BusType.SESSION, "org.example.Demo", "/org/example/demo", 0, null,
+ (obj, res)=>{
+ try {
+ demo = Bus.get_proxy.end (res);
+
+ /* Connecting to signal pong! */
+ demo.pong.connect((c, m) => {
+ stdout.printf ("Got pong %d for msg '%s'\n", c, m);
+ loop.quit ();
+ });
+
+ int pong = demo.ping ("Hello from Vala");
+ stdout.printf ("%d\n", pong);
+
+ pong = demo.ping_with_sender ("Hello from Vala with sender");
+ stdout.printf ("%d\n", pong);
+
+ pong = demo.ping_with_signal ("Hello from Vala with signal");
+ stdout.printf ("%d\n", pong);
+ }
+ catch (IOError e) {
+ stderr.printf ("%s\n", e.message);
+ }
+ }
+ );
- /* Connecting to signal pong! */
- demo.pong.connect((c, m) => {
- stdout.printf ("Got pong %d for msg '%s'\n", c, m);
- loop.quit ();
- });
-
- int pong = demo.ping ("Hello from Vala");
- stdout.printf ("%d\n", pong);
-
- pong = demo.ping_with_sender ("Hello from Vala with sender");
- stdout.printf ("%d\n", pong);
-
- pong = demo.ping_with_signal ("Hello from Vala with signal");
- stdout.printf ("%d\n", pong);
-
- } catch (IOError e) {
- stderr.printf ("%s\n", e.message);
- }
loop.run();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]