summaryrefslogtreecommitdiff
path: root/telepathy-logger/client-factory.c
diff options
context:
space:
mode:
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;
+}