diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-10-11 12:20:40 +0200 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-10-11 12:20:40 +0200 |
commit | 6d33df52b3b2c4ec67f2f191180c2800075a8887 (patch) | |
tree | a5fb4838eee3a0d8415f3af18f49eec309a33966 /telepathy-glib/automatic-proxy-factory.c | |
parent | a1aab2965eadc7a347cc862d7f533f1dc984365a (diff) | |
download | telepathy-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.c | 26 |
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; +} |