* actually *declare* the compact header view.... *d'oh*
[modest] / src / modest-identity-mgr.h
1 /* modest-identity-mgr.h */
2 /* insert (c)/licensing information) */
3
4 #ifndef __MODEST_IDENTITY_MGR_H__
5 #define __MODEST_IDENTITY_MGR_H__
6
7 #include <glib-object.h>
8 #include "modest-conf.h"
9 #include "modest-identity-keys.h"
10 #include "modest-proto.h"
11
12 G_BEGIN_DECLS
13 /* convenience macros */
14 #define MODEST_TYPE_IDENTITY_MGR             (modest_identity_mgr_get_type())
15 #define MODEST_IDENTITY_MGR(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_IDENTITY_MGR,ModestIdentityMgr))
16 #define MODEST_IDENTITY_MGR_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_IDENTITY_MGR,GObject))
17 #define MODEST_IS_IDENTITY_MGR(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_IDENTITY_MGR))
18 #define MODEST_IS_IDENTITY_MGR_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_IDENTITY_MGR))
19 #define MODEST_IDENTITY_MGR_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_IDENTITY_MGR,ModestIdentityMgrClass))
20 typedef struct _ModestIdentityMgr ModestIdentityMgr;
21 typedef struct _ModestIdentityMgrClass ModestIdentityMgrClass;
22
23
24 struct _ModestIdentityMgr {
25         GObject parent;
26         /* insert public members, if any */
27 };
28
29 struct _ModestIdentityMgrClass {
30         GObjectClass parent_class;
31         /* insert signal callback declarations, eg. */
32         /* void (* my_event) (ModestIdentityMgr* obj); */
33 };
34
35
36 /**
37  * modest_ui_get_type:
38  * 
39  * get the GType for ModestIdentityMgr
40  *  
41  * Returns: the GType
42  */
43 GType modest_identity_mgr_get_type (void) G_GNUC_CONST;
44
45
46 /**
47  * modest_identity_mgr_new:
48  * @modest_conf: a ModestConf instance 
49  *  
50  * Returns: a new ModestIdentityMgr, or NULL in case of error
51  */
52 GObject * modest_identity_mgr_new (ModestConf * modest_conf);
53
54
55 /**
56  * modest_identity_mgr_add_identity:
57  * @self: a ModestIdentityMgr instance
58  * @name: the name (id) for the identity
59  * @email: the user's email address which is used when sending email
60  * @replyto: the default replyto address
61  * @signature: the signature for this identity
62  * @use_signature: whether to use this signature instead of the default one
63  * @id_via: the transport to send emails for this identity via
64  * @use_id_via: whether to use this via instead of the default one
65  * 
66  * add a user identity to the configuration
67  * 
68  * Returns: TRUE if  succeeded, FALSE otherwise,
69  */
70 gboolean modest_identity_mgr_add_identity (ModestIdentityMgr * self,
71                                                                                    const gchar * name,
72                                                                                    const gchar * email,
73                                                                                    const gchar * replyto,
74                                                                                    const gchar * signature,
75                                                                                    const gboolean use_signature,
76                                                                                    const gchar * id_via,
77                                                                                    const gboolean use_id_via);
78
79
80 /**
81  * modest_identity_mgr_remove_identity:
82  * @self: a ModestIdentityMgr instance
83  * @name: the name of the identity to remove
84  * @err: a GError ptr, or NULL to ignore.
85  * 
86  * remove identity from the configuration
87  * the identity with @name should exist
88  *
89  * Returns: TRUE if the removal succeeded, FALSE otherwise,
90  * @err gives details in case of error
91  */
92 gboolean modest_identity_mgr_remove_identity (ModestIdentityMgr * self,
93                                                                                           const gchar * name,
94                                                                                           GError ** err);
95
96
97 /**
98  * modest_identity_mgr_identity_names:
99  * @self: a ModestIdentityMgr instance
100  * @err: a GError ptr, or NULL to ignore.
101  * 
102  * list all identities
103  *
104  * Returns: a newly allocated list of identities, or NULL in case of error or
105  * if there are no identities. The caller must free the returned GSList
106  * @err gives details in case of error
107  */
108 GSList *modest_identity_mgr_identity_names (ModestIdentityMgr * self,
109                                                                                         GError ** err);
110
111
112 /**
113  * modest_identity_mgr_identity_exists:
114  * @self: a ModestIdentityMgr instance
115  * @err: a GError ptr, or NULL to ignore.
116  * 
117  * check whether identity @name exists
118  *
119  * Returns: TRUE if the identity exists, FALSE otherwise (or in case of error)
120  * @err gives details in case of error
121  */
122 gboolean modest_identity_mgr_identity_exists (ModestIdentityMgr * self,
123                                                                                           const gchar * name,
124                                                                                           GError ** err);
125
126
127 /* identity specific functions */
128
129 /**
130  * modest_identity_mgr_get_identity_string:
131  * @self: a ModestIdentityMgr instance
132  * @name: the name of the identity
133  * @key: the key of the value to retrieve
134  * @err: a GError ptr, or NULL to ignore.
135  * 
136  * get a config string from an identity
137  *
138  * Returns: a newly allocated string with the value for the key,
139  * or NULL in case of error. @err gives details in case of error
140  */
141 gchar *modest_identity_mgr_get_identity_string (ModestIdentityMgr * self,
142                                                                                                 const gchar * name,
143                                                                                                 const gchar * key,
144                                                                                                 GError ** err);
145
146
147 /**
148  * modest_identity_mgr_get_identity_int:
149  * @self: a ModestIdentityMgr instance
150  * @name: the name of the identity
151  * @key: the key of the value to retrieve
152  * @err: a GError ptr, or NULL to ignore.
153  * 
154  * get a config int from an identity
155  *
156  * Returns: an integer with the value for the key, or -1 in case of
157  * error (but of course -1 does not necessarily imply an error)
158  * @err gives details in case of error
159  */
160 gint modest_identity_mgr_get_identity_int (ModestIdentityMgr * self,
161                                                                                    const gchar * name,
162                                                                                    const gchar * key,
163                                                                                    GError ** err);
164
165
166 /**
167  * modest_identity_mgr_get_identity_bool:
168  * @self: a ModestIdentityMgr instance
169  * @name: the name of the identity
170  * @key: the key of the value to retrieve
171  * @err: a GError ptr, or NULL to ignore.
172  * 
173  * get a config boolean from an identity
174  *
175  * Returns: an boolean with the value for the key, or FALSE in case of
176  * error (but of course FALSE does not necessarily imply an error)
177  * @err gives details in case of error
178  */
179 gboolean modest_identity_mgr_get_identity_bool (ModestIdentityMgr * self,
180                                                                                                 const gchar * name,
181                                                                                                 const gchar * key,
182                                                                                                 GError ** err);
183
184
185 /**
186  * modest_identity_mgr_set_identity_string:
187  * @self: a ModestIdentityMgr instance
188  * @name: the name of the identity
189  * @key: the key of the value to set
190  * @val: the value to set
191  * @err: a GError ptr, or NULL to ignore.
192  * 
193  * set a config string for an identity
194  *
195  * Returns: TRUE if setting the value succeeded, or FALSE in case of error.
196  * @err gives details in case of error
197  */
198 gboolean modest_identity_mgr_set_identity_string (ModestIdentityMgr *
199                                                                                                   self,
200                                                                                                   const gchar * name,
201                                                                                                   const gchar * key,
202                                                                                                   const gchar * val,
203                                                                                                   GError ** err);
204
205
206 /**
207  * modest_identity_mgr_set_identity_int:
208  * @self: a ModestIdentityMgr instance
209  * @name: the name of the identity
210  * @key: the key of the value to set
211  * @val: the value to set
212  * @err: a GError ptr, or NULL to ignore.
213  * 
214  * set a config int for an identity
215  *
216  * Returns: TRUE if setting the value succeeded, or FALSE in case of error.
217  * @err gives details in case of error
218  */
219 gboolean modest_identity_mgr_set_identity_int (ModestIdentityMgr * self,
220                                                                                            const gchar * name,
221                                                                                            const gchar * key,
222                                                                                            gint val, GError ** err);
223
224
225 /**
226  * modest_identity_mgr_set_identity_bool:
227  * @self: a ModestIdentityMgr instance
228  * @name: the name of the identity
229  * @key: the key of the value to set
230  * @val: the value to set
231  * @err: a GError ptr, or NULL to ignore.
232  * 
233  * set a config bool for an identity
234  *
235  * Returns: TRUE if setting the value succeeded, or FALSE in case of error.
236  * @err gives details in case of error
237  */
238 gboolean modest_identity_mgr_set_identity_bool (ModestIdentityMgr * self,
239                                                                                                 const gchar * name,
240                                                                                                 const gchar * key,
241                                                                                                 gboolean val,
242                                                                                                 GError ** err);
243
244
245 G_END_DECLS
246 #endif /* __MODEST_IDENTITY_MGR_H__ */