1 /*
2  * The SSO/libaccounts-glib manager keyfile storage pseudo-plugin
3  *
4  * Copyright © 2010 Nokia Corporation
5  * Copyright © 2010 Collabora Ltd.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20  */
21 
22 #include <mission-control-plugins/mission-control-plugins.h>
23 #include <libaccounts-glib/ag-manager.h>
24 
25 #ifndef __MCD_ACCOUNT_MANAGER_SSO_H__
26 #define __MCD_ACCOUNT_MANAGER_SSO_H__
27 
28 G_BEGIN_DECLS
29 
30 #define MCD_TYPE_ACCOUNT_MANAGER_SSO \
31   (mcd_account_manager_sso_get_type ())
32 
33 #define MCD_ACCOUNT_MANAGER_SSO(o) \
34   (G_TYPE_CHECK_INSTANCE_CAST ((o), MCD_TYPE_ACCOUNT_MANAGER_SSO,   \
35       McdAccountManagerSso))
36 
37 #define MCD_ACCOUNT_MANAGER_SSO_CLASS(k)     \
38     (G_TYPE_CHECK_CLASS_CAST((k), MCD_TYPE_ACCOUNT_MANAGER_SSO, \
39         McdAccountManagerSsoClass))
40 
41 #define MCD_IS_ACCOUNT_MANAGER_SSO(o) \
42   (G_TYPE_CHECK_INSTANCE_TYPE ((o), MCD_TYPE_ACCOUNT_MANAGER_SSO))
43 
44 #define MCD_IS_ACCOUNT_MANAGER_SSO_CLASS(k)  \
45   (G_TYPE_CHECK_CLASS_TYPE ((k), MCD_TYPE_ACCOUNT_MANAGER_SSO))
46 
47 #define MCD_ACCOUNT_MANAGER_SSO_GET_CLASS(o) \
48     (G_TYPE_INSTANCE_GET_CLASS ((o), MCD_TYPE_ACCOUNT_MANAGER_SSO, \
49         McdAccountManagerSsoClass))
50 
51 typedef struct {
52   GObject parent;
53   GHashTable *accounts;
54   GHashTable *id_name_map;
55   GHashTable *watches;
56   GQueue *pending_signals;
57   AgManager *ag_manager;
58   McpAccountManager *manager_interface;
59   gboolean ready;
60   gboolean save;
61   gboolean loaded;
62   guint commit_source;
63 } _McdAccountManagerSso;
64 
65 typedef struct {
66   GObjectClass parent_class;
67 
68   /* In the libaccounts model, each account has a number of associated
69    * 'services'; for example, you might have a Google account with Google Talk,
70    * Google Mail, Google Calendar, etc. services. Each service is of a
71    * particular service type; for instance, the service named "google-talk" is
72    * of type "IM".
73    *
74    * Typically we care about the "IM" service type for Telepathy purposes; but
75    * we allow for the possibility of a subclass which cares about some other
76    * service type.
77    */
78   const gchar *service_type;
79 } _McdAccountManagerSsoClass;
80 
81 typedef _McdAccountManagerSso McdAccountManagerSso;
82 typedef _McdAccountManagerSsoClass McdAccountManagerSsoClass;
83 
84 GType mcd_account_manager_sso_get_type (void) G_GNUC_CONST;
85 
86 McdAccountManagerSso *mcd_account_manager_sso_new (void);
87 
88 /* FIXME: we shouldn't need to expose this. Subclasses should be able to chain
89  * up to the parent class's implementation of the interface method, but they
90  * can't because McpAccountStorageIface isn't exposed. See
91  * <https://bugs.freedesktop.org//show_bug.cgi?id=32914>.
92  */
93 gboolean _mcd_account_manager_sso_get (
94     const McpAccountStorage *self,
95     const McpAccountManager *am,
96     const gchar *account_suffix,
97     const gchar *key);
98 
99 G_END_DECLS
100 
101 #endif
102