aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-uoa-utils.c
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.co.uk>2012-08-24 19:13:07 +0800
committerXavier Claessens <xavier.claessens@collabora.co.uk>2012-08-27 21:47:21 +0800
commitc3933b7972672e533c33cf9f401a1dea83ba1368 (patch)
tree80957d6c8a7244c33d7fdc50bbc6e3a5e8f3b60e /libempathy/empathy-uoa-utils.c
parent1b787a9f326fa5d4224f1a0fe7be56f455b2eedd (diff)
downloadgsoc2013-empathy-c3933b7972672e533c33cf9f401a1dea83ba1368.tar
gsoc2013-empathy-c3933b7972672e533c33cf9f401a1dea83ba1368.tar.gz
gsoc2013-empathy-c3933b7972672e533c33cf9f401a1dea83ba1368.tar.bz2
gsoc2013-empathy-c3933b7972672e533c33cf9f401a1dea83ba1368.tar.lz
gsoc2013-empathy-c3933b7972672e533c33cf9f401a1dea83ba1368.tar.xz
gsoc2013-empathy-c3933b7972672e533c33cf9f401a1dea83ba1368.tar.zst
gsoc2013-empathy-c3933b7972672e533c33cf9f401a1dea83ba1368.zip
UOA: Use an AgManager singleton
This is especially useful in empathy-keyring where it would reload all accounts each time we set a password. https://bugzilla.gnome.org/show_bug.cgi?id=680776
Diffstat (limited to 'libempathy/empathy-uoa-utils.c')
-rw-r--r--libempathy/empathy-uoa-utils.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/libempathy/empathy-uoa-utils.c b/libempathy/empathy-uoa-utils.c
new file mode 100644
index 000000000..f63a15193
--- /dev/null
+++ b/libempathy/empathy-uoa-utils.c
@@ -0,0 +1,49 @@
+/*
+ * empathy-uoa-utils.c - Source for UOA utilities
+ * Copyright (C) 2012 Collabora Ltd.
+ * @author Xavier Claessens <xavier.claessens@collabora.co.uk>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+
+#define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT
+#include "empathy-debug.h"
+#include "empathy-uoa-utils.h"
+
+static AgManager *singleton = NULL;
+
+void
+empathy_uoa_manager_set_default (AgManager *manager)
+{
+ if (singleton != NULL)
+ return;
+
+ singleton = manager;
+ g_object_add_weak_pointer ((GObject *) singleton, (gpointer) &singleton);
+}
+
+AgManager *
+empathy_uoa_manager_dup (void)
+{
+ if (singleton != NULL)
+ return g_object_ref (singleton);
+
+ singleton = ag_manager_new_for_service_type (EMPATHY_UOA_SERVICE_TYPE);
+ g_object_add_weak_pointer ((GObject *) singleton, (gpointer) &singleton);
+
+ return singleton;
+}