[next] telepathy-glib: tube examples: use tp_account_channel_request_new_vardict()

Guillaume Desmottes gdesmott at kemper.freedesktop.org
Thu Feb 20 01:33:14 PST 2014


Module: telepathy-glib
Branch: next
Commit: 8f9aeb03bcfaac8575814ce7b0f5d237bd87552f
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=8f9aeb03bcfaac8575814ce7b0f5d237bd87552f

Author: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
Date:   Mon Feb 17 16:59:25 2014 +0100

tube examples: use tp_account_channel_request_new_vardict()

---

 examples/client/dbus-tubes/offerer.c   |   29 ++++++++---------------------
 examples/client/stream-tubes/offerer.c |   29 ++++++++---------------------
 2 files changed, 16 insertions(+), 42 deletions(-)

diff --git a/examples/client/dbus-tubes/offerer.c b/examples/client/dbus-tubes/offerer.c
index edbc585..b6eb66f 100644
--- a/examples/client/dbus-tubes/offerer.c
+++ b/examples/client/dbus-tubes/offerer.c
@@ -187,7 +187,7 @@ main (int argc,
   char *account_path;
   GError *error = NULL;
   TpAccountChannelRequest *req;
-  GHashTable *request;
+  GVariant *request;
 
   if (argc != 3)
     {
@@ -203,28 +203,16 @@ main (int argc,
   g_assert_no_error (error);
   g_free (account_path);
 
-  request = tp_asv_new (
-      TP_PROP_CHANNEL_CHANNEL_TYPE,
-      G_TYPE_STRING,
-      TP_IFACE_CHANNEL_TYPE_DBUS_TUBE1,
-
-      TP_PROP_CHANNEL_TARGET_ENTITY_TYPE,
-      G_TYPE_UINT,
-      TP_ENTITY_TYPE_CONTACT,
-
-      TP_PROP_CHANNEL_TARGET_ID,
-      G_TYPE_STRING,
-      argv[2],
-
-      TP_PROP_CHANNEL_TYPE_DBUS_TUBE1_SERVICE_NAME,
-      G_TYPE_STRING,
-      EXAMPLE_SERVICE_NAME,
-
-      NULL);
+  request = g_variant_new_parsed (
+      "{ %s: <%s>, %s: <%u>, %s: <%s>, %s: <%s> }",
+      TP_PROP_CHANNEL_CHANNEL_TYPE, TP_IFACE_CHANNEL_TYPE_DBUS_TUBE1,
+      TP_PROP_CHANNEL_TARGET_ENTITY_TYPE, (guint32) TP_ENTITY_TYPE_CONTACT,
+      TP_PROP_CHANNEL_TARGET_ID, argv[2],
+      TP_PROP_CHANNEL_TYPE_DBUS_TUBE1_SERVICE_NAME, EXAMPLE_SERVICE_NAME);
 
   g_message ("Offer channel to %s", argv[2]);
 
-  req = tp_account_channel_request_new (account, request,
+  req = tp_account_channel_request_new_vardict (account, request,
       TP_USER_ACTION_TIME_CURRENT_TIME);
 
   tp_account_channel_request_create_and_handle_channel_async (req, NULL,
@@ -235,7 +223,6 @@ main (int argc,
 
   g_object_unref (account);
   g_object_unref (req);
-  g_hash_table_unref (request);
   g_main_loop_unref (loop);
   g_object_unref (factory);
 
diff --git a/examples/client/stream-tubes/offerer.c b/examples/client/stream-tubes/offerer.c
index 18b6de0..8857d6a 100644
--- a/examples/client/stream-tubes/offerer.c
+++ b/examples/client/stream-tubes/offerer.c
@@ -139,7 +139,7 @@ main (int argc,
   char *account_path;
   GError *error = NULL;
   TpAccountChannelRequest *req;
-  GHashTable *request;
+  GVariant *request;
 
   if (argc != 3)
     {
@@ -155,28 +155,16 @@ main (int argc,
   g_assert_no_error (error);
   g_free (account_path);
 
-  request = tp_asv_new (
-      TP_PROP_CHANNEL_CHANNEL_TYPE,
-      G_TYPE_STRING,
-      TP_IFACE_CHANNEL_TYPE_STREAM_TUBE1,
-
-      TP_PROP_CHANNEL_TARGET_ENTITY_TYPE,
-      G_TYPE_UINT,
-      TP_ENTITY_TYPE_CONTACT,
-
-      TP_PROP_CHANNEL_TARGET_ID,
-      G_TYPE_STRING,
-      argv[2],
-
-      TP_PROP_CHANNEL_TYPE_STREAM_TUBE1_SERVICE,
-      G_TYPE_STRING,
-      "ExampleService",
-
-      NULL);
+  request = g_variant_new_parsed (
+      "{ %s: <%s>, %s: <%u>, %s: <%s>, %s: <%s> }",
+      TP_PROP_CHANNEL_CHANNEL_TYPE, TP_IFACE_CHANNEL_TYPE_STREAM_TUBE1,
+      TP_PROP_CHANNEL_TARGET_ENTITY_TYPE, (guint32) TP_ENTITY_TYPE_CONTACT,
+      TP_PROP_CHANNEL_TARGET_ID, argv[2],
+      TP_PROP_CHANNEL_TYPE_STREAM_TUBE1_SERVICE, "ExampleService");
 
   g_message ("Offer channel to %s", argv[2]);
 
-  req = tp_account_channel_request_new (account, request,
+  req = tp_account_channel_request_new_vardict (account, request,
       TP_USER_ACTION_TIME_CURRENT_TIME);
 
   tp_account_channel_request_create_and_handle_channel_async (req, NULL,
@@ -187,7 +175,6 @@ main (int argc,
 
   g_object_unref (account);
   g_object_unref (req);
-  g_hash_table_unref (request);
   g_main_loop_unref (loop);
   g_object_unref (factory);
 



More information about the telepathy-commits mailing list