summaryrefslogtreecommitdiff
path: root/telepathy-glib/automatic-proxy-factory.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-10-11 12:20:40 +0200
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-10-11 12:20:40 +0200
commit6d33df52b3b2c4ec67f2f191180c2800075a8887 (patch)
treea5fb4838eee3a0d8415f3af18f49eec309a33966 /telepathy-glib/automatic-proxy-factory.c
parenta1aab2965eadc7a347cc862d7f533f1dc984365a (diff)
downloadtelepathy-glib-6d33df52b3b2c4ec67f2f191180c2800075a8887.tar.gz
add tp_automatic_proxy_factory_dup()
Diffstat (limited to 'telepathy-glib/automatic-proxy-factory.c')
-rw-r--r--telepathy-glib/automatic-proxy-factory.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/telepathy-glib/automatic-proxy-factory.c b/telepathy-glib/automatic-proxy-factory.c
index ff7b3a870..9d70c5b23 100644
--- a/telepathy-glib/automatic-proxy-factory.c
+++ b/telepathy-glib/automatic-proxy-factory.c
@@ -135,3 +135,29 @@ tp_automatic_proxy_factory_new (void)
return g_object_new (TP_TYPE_AUTOMATIC_PROXY_FACTORY,
NULL);
}
+
+/**
+ * tp_automatic_proxy_factory_dup:
+ *
+ * Returns a cached #TpAutomaticProxyFactory; the same
+ * #TpAutomaticProxyFactory object will be returned by this function repeatedly,
+ * as long as at least one reference exists.
+ *
+ * Returns: (transfer full): a #TpAutomaticProxyFactory
+ *
+ * Since: 0.13.UNRELEASED
+ */
+TpAutomaticProxyFactory *
+tp_automatic_proxy_factory_dup (void)
+{
+ static TpAutomaticProxyFactory *singleton = NULL;
+
+ if (singleton != NULL)
+ return g_object_ref (singleton);
+
+ singleton = tp_automatic_proxy_factory_new ();
+
+ g_object_add_weak_pointer (G_OBJECT (singleton), (gpointer) &singleton);
+
+ return singleton;
+}