summaryrefslogtreecommitdiff
path: root/telepathy-glib/account-manager.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2011-08-02 17:40:14 +0200
committerXavier Claessens <xclaesse@gmail.com>2011-08-17 13:19:06 +0200
commite896dac5070c46b1ac566dd5fa646be9ebe55ee9 (patch)
treeb1cb9986a75ea839f2bf8ffd55732ac825ab4d10 /telepathy-glib/account-manager.c
parentb730034fd48b523b0ad562c07e7fe8cb572de99d (diff)
downloadtelepathy-glib-e896dac5070c46b1ac566dd5fa646be9ebe55ee9.tar.gz
Add tp_account_manager_set_default()
This defines the TpAccountManager returned by tp_account_manager_dup()
Diffstat (limited to 'telepathy-glib/account-manager.c')
-rw-r--r--telepathy-glib/account-manager.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/telepathy-glib/account-manager.c b/telepathy-glib/account-manager.c
index cefae3270..ba45bcc28 100644
--- a/telepathy-glib/account-manager.c
+++ b/telepathy-glib/account-manager.c
@@ -33,6 +33,7 @@
#include "telepathy-glib/_gen/signals-marshal.h"
#define DEBUG_FLAG TP_DEBUG_ACCOUNTS
+#include "telepathy-glib/dbus-internal.h"
#include "telepathy-glib/debug-internal.h"
#include "telepathy-glib/proxy-internal.h"
#include "telepathy-glib/simple-client-factory-internal.h"
@@ -734,6 +735,34 @@ _tp_account_manager_new_with_factory (TpSimpleClientFactory *factory,
static gpointer starter_account_manager_proxy = NULL;
/**
+ * tp_account_manager_set_default:
+ * @manager: a #TpAccountManager
+ *
+ * Define the #TpAccountManager singleton that will be returned by
+ * tp_account_manager_dup().
+ *
+ * This function can only be called before the first usage of
+ * tp_account_manager_dup(). It is useful for applications using a custom
+ * #TpSimpleClientFactory and want the default Account Manager to use it. See
+ * tp_account_manager_new_with_factory().
+ *
+ * Note that @manager must use the default dbus-daemon as returned by
+ * tp_dbus_daemon_dup()
+ *
+ * Since: 0.UNRELEASED
+ */
+void
+tp_account_manager_set_default (TpAccountManager *manager)
+{
+ g_return_if_fail (TP_IS_ACCOUNT_MANAGER (manager));
+ g_return_if_fail (_tp_dbus_daemon_is_the_shared_one (
+ tp_proxy_get_dbus_daemon (manager)));
+ g_return_if_fail (starter_account_manager_proxy == NULL);
+
+ starter_account_manager_proxy = g_object_ref (manager);
+}
+
+/**
* tp_account_manager_dup:
*
* Returns an account manager proxy on the D-Bus daemon on which this