summaryrefslogtreecommitdiff
path: root/telepathy-logger/client-factory.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2013-09-23 17:28:56 +0200
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2013-09-25 16:36:30 +0200
commit30f231cc4b89aac17dd0c1426ac0f11df7056454 (patch)
treeef667425daa73568d9d768f60c5bb28821c2ac50 /telepathy-logger/client-factory.c
parent8e85b78d6aee35b0eb7181c8ad6a870c22fc8a37 (diff)
downloadtelepathy-logger-30f231cc4b89aac17dd0c1426ac0f11df7056454.tar.gz
client-factory: turn to a singleton
https://bugs.freedesktop.org/show_bug.cgi?id=69797
Diffstat (limited to 'telepathy-logger/client-factory.c')
-rw-r--r--telepathy-logger/client-factory.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/telepathy-logger/client-factory.c b/telepathy-logger/client-factory.c
index 0d4b131..b3dd9fe 100644
--- a/telepathy-logger/client-factory.c
+++ b/telepathy-logger/client-factory.c
@@ -94,10 +94,26 @@ _tpl_client_factory_class_init (TplClientFactoryClass *cls)
simple_class->dup_channel_features = dup_channel_features_impl;
}
-TpSimpleClientFactory *
+
+static TpSimpleClientFactory *
_tpl_client_factory_new (TpDBusDaemon *dbus)
{
return g_object_new (TPL_TYPE_CLIENT_FACTORY,
"dbus-daemon", dbus,
NULL);
}
+
+TpSimpleClientFactory *
+_tpl_client_factory_dup (TpDBusDaemon *dbus)
+{
+ static TpSimpleClientFactory *singleton = NULL;
+
+ if (singleton != NULL)
+ return g_object_ref (singleton);
+
+ singleton = _tpl_client_factory_new (dbus);
+
+ g_object_add_weak_pointer (G_OBJECT (singleton), (gpointer) &singleton);
+
+ return singleton;
+}