]> git.0d.be Git - empathy.git/blob - libempathy/empathy-uoa-utils.c
f63a1519386a3a715decbdbe601f377b322d41fa
[empathy.git] / libempathy / empathy-uoa-utils.c
1 /*
2  * empathy-uoa-utils.c - Source for UOA utilities
3  * Copyright (C) 2012 Collabora Ltd.
4  * @author Xavier Claessens <xavier.claessens@collabora.co.uk>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19  */
20
21 #include "config.h"
22
23 #define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT
24 #include "empathy-debug.h"
25 #include "empathy-uoa-utils.h"
26
27 static AgManager *singleton = NULL;
28
29 void
30 empathy_uoa_manager_set_default (AgManager *manager)
31 {
32   if (singleton != NULL)
33     return;
34
35   singleton = manager;
36   g_object_add_weak_pointer ((GObject *) singleton, (gpointer) &singleton);
37 }
38
39 AgManager *
40 empathy_uoa_manager_dup (void)
41 {
42   if (singleton != NULL)
43     return g_object_ref (singleton);
44
45   singleton = ag_manager_new_for_service_type (EMPATHY_UOA_SERVICE_TYPE);
46   g_object_add_weak_pointer ((GObject *) singleton, (gpointer) &singleton);
47
48   return singleton;
49 }