Add account preset object draft.
[modest] / experimental / modest / src / modest-account-mgr.h
1 /* modest-account-mgr.h */
2 /* insert (c)/licensing information) */
3
4 #ifndef __MODEST_ACCOUNT_MGR_H__
5 #define __MODEST_ACCOUNT_MGR_H__
6
7 #include <glib-object.h>
8 #include "modest-conf.h"
9 #include "modest-account-keys.h"
10
11 G_BEGIN_DECLS
12
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))
20
21 typedef struct _ModestAccountMgr      ModestAccountMgr;
22 typedef struct _ModestAccountMgrClass ModestAccountMgrClass;
23
24 struct _ModestAccountMgr {
25          GObject parent;
26         /* insert public members, if any */
27 };
28
29 struct _ModestAccountMgrClass {
30         GObjectClass parent_class;
31         /* insert signal callback declarations, eg. */
32         /* void (* my_event) (ModestAccountMgr* obj); */
33 };
34
35
36 /**
37  * modest_ui_get_type:
38  * 
39  * get the GType for ModestAccountMgr
40  *  
41  * Returns: the GType
42  */
43 GType           modest_account_mgr_get_type       (void) G_GNUC_CONST;
44
45
46 /**
47  * modest_account_mgr_new:
48  * @modest_conf: a ModestConf instance 
49  *  
50  * Returns: a new ModestAccountMgr, or NULL in case of error
51  */
52 GObject*        modest_account_mgr_new            (ModestConf *modest_conf);
53
54
55 /**
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.
60  * 
61  * create a new account. the account with @name should not already exist
62  *
63  * Returns: TRUE if the creation succeeded, FALSE otherwise,
64  * @err gives details in case of error
65  */
66 gboolean        modest_account_mgr_add_account    (ModestAccountMgr *self, const gchar* name,
67                                                    GError **err);
68
69 /**
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.
74  * 
75  * remove an existing account. the account with @name should already exist
76  *
77  * Returns: TRUE if the creation succeeded, FALSE otherwise,
78  * @err gives details in case of error
79  */
80 gboolean        modest_account_mgr_remove_account         (ModestAccountMgr *self, const gchar* name,
81                                                            GError **err);
82 /**
83  * modest_account_mgr_account_names:
84  * @self: a ModestAccountMgr instance
85  * @err: a GError ptr, or NULL to ignore.
86  * 
87  * list all account names
88  *
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
92  */
93 GSList*         modest_account_mgr_account_names          (ModestAccountMgr *self, GError **err);
94
95
96 /**
97  * modest_account_mgr_account_exists:
98  * @self: a ModestAccountMgr instance
99  * @err: a GError ptr, or NULL to ignore.
100  * 
101  * check whether account @name exists
102  *
103  * Returns: TRUE if the account exists, FALSE otherwise (or in case of error)
104  * @err gives details in case of error
105  */
106 gboolean        modest_account_mgr_account_exists         (ModestAccountMgr *self,
107                                                            const gchar *name,
108                                                            GError **err);
109
110 /* account specific functions */
111
112
113
114 /**
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.
120  * 
121  * get a config string from some account
122  *
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
125  */
126 gchar*          modest_account_mgr_get_account_string     (ModestAccountMgr *self,
127                                                            const gchar *name,
128                                                            const gchar *key, GError **err);
129 /**
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.
135  * 
136  * get a config int from some account
137  *
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
141  */
142 gint            modest_account_mgr_get_account_int        (ModestAccountMgr *self,
143                                                            const gchar *name,
144                                                            const gchar *key, GError **err);
145
146
147 /**
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.
153  * 
154  * get a config boolean from some account
155  *
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
159  */
160 gboolean        modest_account_mgr_get_account_bool       (ModestAccountMgr *self,
161                                                            const gchar *name,
162                                                            const gchar *key, GError **err);
163
164
165 /**
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.
172  * 
173  * set a config string for some account
174  *
175  * Returns: TRUE if setting the value succeeded, or FALSE in case of error.
176  * @err gives details in case of error
177  */
178 gboolean        modest_account_mgr_set_account_string     (ModestAccountMgr *self,
179                                                            const gchar *name,
180                                                            const gchar *key, const gchar* val,
181                                                            GError **err);
182 /**
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.
189  * 
190  * set a config int for some account
191  *
192  * Returns: TRUE if setting the value succeeded, or FALSE in case of error.
193  * @err gives details in case of error
194  */
195 gboolean        modest_account_mgr_set_account_int        (ModestAccountMgr *self,
196                                                            const gchar *name,
197                                                            const gchar *key, gint val,
198                                                            GError **err);
199
200 /**
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.
207  * 
208  * set a config bool for some account
209  *
210  * Returns: TRUE if setting the value succeeded, or FALSE in case of error.
211  * @err gives details in case of error
212  */
213 gboolean        modest_account_mgr_set_account_bool       (ModestAccountMgr *self,
214                                                            const gchar *name,
215                                                            const gchar *key, gboolean val,
216                                                            GError **err);
217 G_END_DECLS
218
219 #endif /* __MODEST_ACCOUNT_MGR_H__ */
220