[Pkg-telepathy-commits] [telepathy-mission-control-6] 55/90: McdMaster: take a TpClientFactory at construct-time

Simon McVittie smcv at debian.org
Wed May 14 12:09:05 UTC 2014


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch debian
in repository telepathy-mission-control-6.

commit a1e564f0b14cf868e61d5d3cadcf145cc82495c9
Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Tue Apr 1 12:17:48 2014 +0100

    McdMaster: take a TpClientFactory at construct-time
    
    We don't want the shared singleton (tp_client_factory_dup()) because
    it constructs specialized TpChannel subclasses, and we'd rather have
    the base class. Similarly, if a plugin asks for extra features on the
    shared singleton, MC actively doesn't want them.
---
 src/mcd-master.c  | 23 +++++++++++++++++------
 src/mcd-service.c |  6 +++++-
 2 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/src/mcd-master.c b/src/mcd-master.c
index 2dbfe61..822dc30 100644
--- a/src/mcd-master.c
+++ b/src/mcd-master.c
@@ -107,6 +107,7 @@ enum
     PROP_DBUS_DAEMON,
     PROP_DISPATCHER,
     PROP_ACCOUNT_MANAGER,
+    PROP_FACTORY,
 };
 
 /* Used to poison 'default_master' when the object it points to is disposed.
@@ -126,6 +127,9 @@ _mcd_master_get_property (GObject * obj, guint prop_id,
     case PROP_DISPATCHER:
 	g_value_set_object (val, priv->dispatcher);
 	break;
+    case PROP_FACTORY:
+        g_value_set_object (val, priv->client_factory);
+        break;
     case PROP_DBUS_DAEMON:
 	g_value_set_object (val, priv->dbus_daemon);
 	break;
@@ -150,10 +154,12 @@ _mcd_master_set_property (GObject *obj, guint prop_id,
 
     switch (prop_id)
     {
-    case PROP_DBUS_DAEMON:
-	g_assert (priv->dbus_daemon == NULL);
-	priv->dbus_daemon = g_value_dup_object (val);
-	break;
+    case PROP_FACTORY:
+        g_assert (priv->client_factory == NULL);
+        priv->client_factory = g_value_dup_object (val);
+        priv->dbus_daemon = tp_client_factory_get_dbus_daemon (
+            priv->client_factory);
+        break;
     default:
 	G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
 	break;
@@ -202,7 +208,6 @@ mcd_master_constructor (GType type, guint n_params,
     umask (0077);
 #endif
 
-    priv->client_factory = tp_client_factory_new (priv->dbus_daemon);
     priv->account_manager = mcd_account_manager_new (priv->client_factory);
 
     priv->dispatcher = mcd_dispatcher_new (priv->dbus_daemon, master);
@@ -234,10 +239,16 @@ mcd_master_class_init (McdMasterClass * klass)
                               G_PARAM_READABLE));
 
     g_object_class_install_property
+        (object_class, PROP_FACTORY,
+         g_param_spec_object ("factory", "Factory", "Client factory",
+                              TP_TYPE_CLIENT_FACTORY,
+                              G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+    g_object_class_install_property
         (object_class, PROP_DBUS_DAEMON,
          g_param_spec_object ("dbus-daemon", "DBus daemon", "DBus daemon",
                               TP_TYPE_DBUS_DAEMON,
-                              G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+                              G_PARAM_READABLE));
 
     g_object_class_install_property
         (object_class, PROP_DBUS_CONNECTION,
diff --git a/src/mcd-service.c b/src/mcd-service.c
index 3e68861..705298f 100644
--- a/src/mcd-service.c
+++ b/src/mcd-service.c
@@ -171,19 +171,23 @@ mcd_service_new (void)
 {
     McdService *obj;
     TpDBusDaemon *dbus_daemon;
+    TpClientFactory *factory;
     GError *error = NULL;
 
     /* Initialize DBus connection */
     dbus_daemon = tp_dbus_daemon_dup (&error);
+
     if (dbus_daemon == NULL)
     {
 	g_printerr ("Failed to open connection to bus: %s", error->message);
 	g_error_free (error);
 	return NULL;
     }
+    factory = tp_client_factory_new (dbus_daemon);
     obj = g_object_new (MCD_TYPE_SERVICE,
-			"dbus-daemon", dbus_daemon,
+			"factory", factory,
 			NULL);
+    g_object_unref (factory);
     g_object_unref (dbus_daemon);
     return obj;
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-telepathy/telepathy-mission-control-6.git



More information about the Pkg-telepathy-commits mailing list