1 /* modest-account-mgr.h */
2 /* insert (c)/licensing information) */
4 #ifndef __MODEST_ACCOUNT_MGR_H__
5 #define __MODEST_ACCOUNT_MGR_H__
7 #include <glib-object.h>
8 #include "modest-conf.h"
9 #include "modest-account-keys.h"
13 /* convenience macros */
14 #define MODEST_TYPE_ACCOUNT_MGR (modest_account_mgr_get_type())
15 #define MODEST_ACCOUNT_MGR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_ACCOUNT_MGR,ModestAccountMgr))
16 #define MODEST_ACCOUNT_MGR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_ACCOUNT_MGR,GObject))
17 #define MODEST_IS_ACCOUNT_MGR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_ACCOUNT_MGR))
18 #define MODEST_IS_ACCOUNT_MGR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_ACCOUNT_MGR))
19 #define MODEST_ACCOUNT_MGR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_ACCOUNT_MGR,ModestAccountMgrClass))
21 typedef struct _ModestAccountMgr ModestAccountMgr;
22 typedef struct _ModestAccountMgrClass ModestAccountMgrClass;
24 struct _ModestAccountMgr {
26 /* insert public members, if any */
29 struct _ModestAccountMgrClass {
30 GObjectClass parent_class;
31 /* insert signal callback declarations, eg. */
32 /* void (* my_event) (ModestAccountMgr* obj); */
39 * get the GType for ModestAccountMgr
43 GType modest_account_mgr_get_type (void) G_GNUC_CONST;
47 * modest_account_mgr_new:
48 * @modest_conf: a ModestConf instance
50 * Returns: a new ModestAccountMgr, or NULL in case of error
52 GObject* modest_account_mgr_new (ModestConf *modest_conf);
56 * modest_account_mgr_add_account:
57 * @self: a ModestAccountMgr instance
58 * @name: the name of the account to create
59 * @err: a GError ptr, or NULL to ignore.
61 * create a new account. the account with @name should not already exist
63 * Returns: TRUE if the creation succeeded, FALSE otherwise,
64 * @err gives details in case of error
66 gboolean modest_account_mgr_add_account (ModestAccountMgr *self, const gchar* name,
70 * modest_account_mgr_remove_account:
71 * @self: a ModestAccountMgr instance
72 * @name: the name of the account to remove
73 * @err: a GError ptr, or NULL to ignore.
75 * remove an existing account. the account with @name should already exist
77 * Returns: TRUE if the creation succeeded, FALSE otherwise,
78 * @err gives details in case of error
80 gboolean modest_account_mgr_remove_account (ModestAccountMgr *self, const gchar* name,
83 * modest_account_mgr_account_names:
84 * @self: a ModestAccountMgr instance
85 * @err: a GError ptr, or NULL to ignore.
87 * list all account names
89 * Returns: a newly allocated list of account names, or NULL in case of error or
90 * if there are no accounts. The caller must free the returned GSList
91 * @err gives details in case of error
93 GSList* modest_account_mgr_account_names (ModestAccountMgr *self, GError **err);
97 * modest_account_mgr_account_exists:
98 * @self: a ModestAccountMgr instance
99 * @err: a GError ptr, or NULL to ignore.
101 * check whether account @name exists
103 * Returns: TRUE if the account exists, FALSE otherwise (or in case of error)
104 * @err gives details in case of error
106 gboolean modest_account_mgr_account_exists (ModestAccountMgr *self,
110 /* account specific functions */
115 * modest_account_mgr_get_account_string:
116 * @self: self a ModestAccountMgr instance
117 * @name: the name of the account
118 * @key: the key of the value to retrieve
119 * @err: a GError ptr, or NULL to ignore.
121 * get a config string from some account
123 * Returns: a newly allocated string with the value for the key,
124 * or NULL in case of error. @err gives details in case of error
126 gchar* modest_account_mgr_get_account_string (ModestAccountMgr *self,
128 const gchar *key, GError **err);
130 * modest_account_mgr_get_account_int:
131 * @self: self a ModestAccountMgr instance
132 * @name: the name of the account
133 * @key: the key of the value to retrieve
134 * @err: a GError ptr, or NULL to ignore.
136 * get a config int from some account
138 * Returns: an integer with the value for the key, or -1 in case of
139 * error (but of course -1 does not necessarily imply an error)
140 * @err gives details in case of error
142 gint modest_account_mgr_get_account_int (ModestAccountMgr *self,
144 const gchar *key, GError **err);
148 * modest_account_mgr_get_account_bool:
149 * @self: self a ModestAccountMgr instance
150 * @name: the name of the account
151 * @key: the key of the value to retrieve
152 * @err: a GError ptr, or NULL to ignore.
154 * get a config boolean from some account
156 * Returns: an boolean with the value for the key, or FALSE in case of
157 * error (but of course FALSE does not necessarily imply an error)
158 * @err gives details in case of error
160 gboolean modest_account_mgr_get_account_bool (ModestAccountMgr *self,
162 const gchar *key, GError **err);
166 * modest_account_mgr_set_account_string:
167 * @self: self a ModestAccountMgr instance
168 * @name: the name of the account
169 * @key: the key of the value to set
170 * @val: the value to set
171 * @err: a GError ptr, or NULL to ignore.
173 * set a config string for some account
175 * Returns: TRUE if setting the value succeeded, or FALSE in case of error.
176 * @err gives details in case of error
178 gboolean modest_account_mgr_set_account_string (ModestAccountMgr *self,
180 const gchar *key, const gchar* val,
183 * modest_account_mgr_set_account_int:
184 * @self: self a ModestAccountMgr instance
185 * @name: the name of the account
186 * @key: the key of the value to set
187 * @val: the value to set
188 * @err: a GError ptr, or NULL to ignore.
190 * set a config int for some account
192 * Returns: TRUE if setting the value succeeded, or FALSE in case of error.
193 * @err gives details in case of error
195 gboolean modest_account_mgr_set_account_int (ModestAccountMgr *self,
197 const gchar *key, gint val,
201 * modest_account_mgr_set_account_bool:
202 * @self: self a ModestAccountMgr instance
203 * @name: the name of the account
204 * @key: the key of the value to set
205 * @val: the value to set
206 * @err: a GError ptr, or NULL to ignore.
208 * set a config bool for some account
210 * Returns: TRUE if setting the value succeeded, or FALSE in case of error.
211 * @err gives details in case of error
213 gboolean modest_account_mgr_set_account_bool (ModestAccountMgr *self,
215 const gchar *key, gboolean val,
219 #endif /* __MODEST_ACCOUNT_MGR_H__ */