[next] telepathy-mission-control: mc-tool: use the global singleton client factory

Simon McVittie smcv at kemper.freedesktop.org
Thu Apr 3 07:28:06 PDT 2014


Module: telepathy-mission-control
Branch: next
Commit: 82071042392f05c66e04345ed160a61cf6cea82c
URL:    http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=82071042392f05c66e04345ed160a61cf6cea82c

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Tue Apr  1 13:44:45 2014 +0100

mc-tool: use the global singleton client factory

---

 util/mc-tool.c |   16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/util/mc-tool.c b/util/mc-tool.c
index f642fe9..9fa3fae 100644
--- a/util/mc-tool.c
+++ b/util/mc-tool.c
@@ -1471,7 +1471,6 @@ main (int argc, char **argv)
 {
   TpAccountManager *am = NULL;
   TpAccount *a = NULL;
-  TpDBusDaemon *dbus = NULL;
   TpClientFactory *client_factory = NULL;
   GError *error = NULL;
   const GQuark features[] = { TP_ACCOUNT_FEATURE_CORE,
@@ -1485,7 +1484,8 @@ main (int argc, char **argv)
 
   command.common.ret = 1;
 
-  dbus = tp_dbus_daemon_dup (&error);
+  client_factory = tp_client_factory_dup (&error);
+
   if (error != NULL)
     {
       fprintf (stderr, "%s %s: Failed to connect to D-Bus: %s\n",
@@ -1493,17 +1493,10 @@ main (int argc, char **argv)
       goto out;
     }
 
-  client_factory = tp_client_factory_new (dbus);
-
   if (command.common.account == NULL)
     {
-      TpClientFactory *factory;
-
-      am = tp_account_manager_new (dbus);
-      factory = tp_proxy_get_factory (am);
-
-      tp_client_factory_add_account_features (factory, features);
-
+      tp_client_factory_add_account_features (client_factory, features);
+      am = tp_client_factory_ensure_account_manager (client_factory);
       tp_proxy_prepare_async (am, NULL, manager_ready, NULL);
     }
   else
@@ -1528,7 +1521,6 @@ main (int argc, char **argv)
 out:
   g_clear_error (&error);
   tp_clear_object (&client_factory);
-  tp_clear_object (&dbus);
   tp_clear_object (&am);
   tp_clear_object (&a);
   tp_clear_pointer (&main_loop, g_main_loop_unref);



More information about the telepathy-commits mailing list