* Fixes NB#104978, crash in account wizard when language/region do not match
[modest] / src / modest-account-settings.h
1 /* Copyright (c) 2007, Nokia Corporation
2  * All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  *   notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  *   notice, this list of conditions and the following disclaimer in the
12  *   documentation and/or other materials provided with the distribution.
13  * * Neither the name of the Nokia Corporation nor the names of its
14  *   contributors may be used to endorse or promote products derived from
15  *   this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
18  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
21  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29
30
31 /* modest-account-settings.h */
32
33 #ifndef __MODEST_ACCOUNT_SETTINGS_H__
34 #define __MODEST_ACCOUNT_SETTINGS_H__
35
36 #include <glib-object.h>
37 #include <modest-server-account-settings.h>
38
39 G_BEGIN_DECLS
40
41 /* convenience macros */
42 #define MODEST_TYPE_ACCOUNT_SETTINGS             (modest_account_settings_get_type())
43 #define MODEST_ACCOUNT_SETTINGS(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_ACCOUNT_SETTINGS,ModestAccountSettings))
44 #define MODEST_ACCOUNT_SETTINGS_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_ACCOUNT_SETTINGS,ModestAccountSettingsClass))
45 #define MODEST_IS_ACCOUNT_SETTINGS(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_ACCOUNT_SETTINGS))
46 #define MODEST_IS_ACCOUNT_SETTINGS_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_ACCOUNT_SETTINGS))
47 #define MODEST_ACCOUNT_SETTINGS_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_ACCOUNT_SETTINGS,ModestAccountSettingsClass))
48
49 typedef struct _ModestAccountSettings      ModestAccountSettings;
50 typedef struct _ModestAccountSettingsClass ModestAccountSettingsClass;
51
52 struct _ModestAccountSettings {
53         GObject parent;
54 };
55
56 struct _ModestAccountSettingsClass {
57         GObjectClass parent_class;
58 };
59
60 typedef enum {
61         MODEST_ACCOUNT_RETRIEVE_HEADERS_ONLY = 0,
62         MODEST_ACCOUNT_RETRIEVE_MESSAGES,
63         MODEST_ACCOUNT_RETRIEVE_MESSAGES_AND_ATTACHMENTS
64 } ModestAccountRetrieveType;
65
66
67 /**
68  * modest_account_settings_get_type:
69  *
70  * Returns: GType of the account store
71  */
72 GType  modest_account_settings_get_type   (void) G_GNUC_CONST;
73
74 /**
75  * modest_account_settings_new:
76  *
77  * creates a new instance of #ModestAccountSettings
78  *
79  * Returns: a #ModestAccountSettings
80  */
81 ModestAccountSettings*    modest_account_settings_new (void);
82
83 /**
84  * modest_account_settings_get_fullname:
85  * @settings: a #ModestAccountSettings
86  *
87  * get the user full name.
88  *
89  * Returns: a string
90  */
91 const gchar* modest_account_settings_get_fullname (ModestAccountSettings *settings);
92
93 /**
94  * modest_account_settings_set_fullname:
95  * @settings: a #ModestAccountSettings
96  * @hostname: a string.
97  *
98  * set @fullname as the user full name .
99  */
100 void         modest_account_settings_set_fullname (ModestAccountSettings *settings,
101                                                    const gchar *fullname);
102 /**
103  * modest_account_settings_get_email_address:
104  * @settings: a #ModestAccountSettings
105  *
106  * get the user email address.
107  *
108  * Returns: a string
109  */
110 const gchar* modest_account_settings_get_email_address (ModestAccountSettings *settings);
111
112 /**
113  * modest_account_settings_set_email_address:
114  * @settings: a #ModestAccountSettings
115  * @hostname: a string.
116  *
117  * set @email_address of the account.
118  */
119 void         modest_account_settings_set_email_address (ModestAccountSettings *settings,
120                                                         const gchar *email_address);
121 /**
122  * modest_account_settings_get_retrieve_type:
123  * @settings: a #ModestAccountSettings
124  *
125  * get the account retrieve type.
126  *
127  * Returns: a #ModestAccountRetrieveType
128  */
129 ModestAccountRetrieveType modest_account_settings_get_retrieve_type (ModestAccountSettings *settings);
130
131 /**
132  * modest_account_settings_set_retrieve_type:
133  * @settings: a #ModestAccountSettings
134  * @retrieve_type: a #ModestAccountRetrieveType.
135  *
136  * set @retrieve_type of the account.
137  */
138 void         modest_account_settings_set_retrieve_type (ModestAccountSettings *settings,
139                                                         ModestAccountRetrieveType retrieve_type);
140
141 /**
142  * modest_account_settings_get_retrieve_limit:
143  * @settings: a #ModestAccountSettings
144  *
145  * get the account retrieve limit. 0 is no limit.
146  *
147  * Returns: a #gint
148  */
149 gint modest_account_settings_get_retrieve_limit (ModestAccountSettings *settings);
150
151 /**
152  * modest_account_settings_set_retrieve_limit:
153  * @settings: a #ModestAccountSettings
154  * @retrieve_limit: a #gint.
155  *
156  * set @retrieve_limit of the account. 0 is no limit.
157  */
158 void         modest_account_settings_set_retrieve_limit (ModestAccountSettings *settings,
159                                                          gint retrieve_limit);
160
161 /**
162  * modest_account_settings_get_display_name:
163  * @settings: a #ModestAccountSettings
164  *
165  * get the visible name of the account.
166  *
167  * Returns: a string
168  */
169 const gchar* modest_account_settings_get_display_name (ModestAccountSettings *settings);
170
171 /**
172  * modest_account_settings_set_display_name:
173  * @settings: a #ModestAccountSettings
174  * @hostname: a string.
175  *
176  * set @display_name as the name of the account visible to the users in UI.
177  */
178 void         modest_account_settings_set_display_name (ModestAccountSettings *settings,
179                                                        const gchar *display_name);
180
181 /**
182  * modest_account_settings_get_account_name:
183  * @settings: a #ModestAccountSettings
184  *
185  * get the #ModestAccountMgr account name for these settings, or
186  * %NULL if it's not in the manager.
187  *
188  * Returns: a string, or %NULL
189  */
190 const gchar *modest_account_settings_get_account_name (ModestAccountSettings *settings);
191
192 /**
193  * modest_account_settings_set_account_name:
194  * @settings: a #ModestAccountSettings
195  * @account_name: a string
196  *
197  * sets the account name that will be used to store the account settings. This should
198  * only be called from #ModestAccountMgr and #ModestAccountSettings.
199  */
200 void modest_account_settings_set_account_name (ModestAccountSettings *settings,
201                                                const gchar *account_name);
202
203 /**
204  * modest_account_settings_get_enabled:
205  * @settings: a #ModestAccountSettings
206  *
207  * obtains whether the account is enabled or not.
208  *
209  * Returns: a #gboolean
210  */
211 gboolean modest_account_settings_get_enabled (ModestAccountSettings *settings);
212                                               
213 /**
214  * modest_account_settings_set_enabled:
215  * @settings: a #ModestAccountSettings
216  * @enabled: a #gboolean
217  *
218  * set if @settings account is enabled or not.
219  */
220 void modest_account_settings_set_enabled (ModestAccountSettings *settings, gboolean enabled);
221
222
223 /**
224  * modest_account_settings_get_is_default:
225  * @settings: a #ModestAccountSettings
226  *
227  * obtains whether the account is the default account or not.
228  *
229  * Returns: a #gboolean
230  */
231 gboolean modest_account_settings_get_is_default (ModestAccountSettings *settings);
232                                               
233 /**
234  * modest_account_settings_set_is_default:
235  * @settings: a #ModestAccountSettings
236  * @is_default: a #gboolean
237  *
238  * set if @settings account is the default account or not.
239  */
240 void modest_account_settings_set_is_default (ModestAccountSettings *settings, gboolean is_default);
241
242 /**
243  * modest_account_settings_get_store_settings:
244  * @settings: a #ModestAccountSettings
245  *
246  * obtains a ref'ed instance of the store account server settings
247  *
248  * Returns: a ref'd #ModestServerAccountSettings. You should unreference it on finishing usage.
249  */
250 ModestServerAccountSettings *modest_account_settings_get_store_settings (ModestAccountSettings *settings);
251
252 /**
253  * modest_account_settings_set_store_settings:
254  * @settings: a #ModestAccountSettings
255  *
256  * sets @store_settings as the settings of the store account of @settings account.
257  * @settings will keep an internal reference to it.
258  */
259 void modest_account_settings_set_store_settings (ModestAccountSettings *settings, 
260                                                  ModestServerAccountSettings *store_settings);
261
262 /**
263  * modest_account_settings_get_transport_settings:
264  * @settings: a #ModestAccountSettings
265  *
266  * obtains a ref'ed instance of the transport account server settings
267  *
268  * Returns: a ref'd #ModestServerAccountSettings. You should unreference it on finishing usage.
269  */
270 ModestServerAccountSettings *modest_account_settings_get_transport_settings (ModestAccountSettings *settings);
271
272 /**
273  * modest_account_settings_set_transport_settings:
274  * @settings: a #ModestAccountSettings
275  *
276  * sets @transport_settings as the settings of the transport account of @settings account.
277  * @settings will keep an internal reference to it.
278  */
279 void modest_account_settings_set_transport_settings (ModestAccountSettings *settings, 
280                                                      ModestServerAccountSettings *transport_settings);
281
282 /**
283  * modest_account_settings_get_use_signature:
284  * @settings: a #ModestAccountSettings
285  *
286  * obtains whether the mails from this account use signature or not.
287  *
288  * Returns: a #gboolean
289  */
290 gboolean modest_account_settings_get_use_signature (ModestAccountSettings *settings);
291                                               
292 /**
293  * modest_account_settings_set_use_signature:
294  * @settings: a #ModestAccountSettings
295  * @use_signature: a #gboolean
296  *
297  * set if @settings mails use signature or not
298  */
299 void modest_account_settings_set_use_signature (ModestAccountSettings *settings, gboolean use_signature);
300
301 /**
302  * modest_account_settings_get_signature:
303  * @settings: a #ModestAccountSettings
304  *
305  * get the signature.
306  *
307  * Returns: a string
308  */
309 const gchar* modest_account_settings_get_signature (ModestAccountSettings *settings);
310
311 /**
312  * modest_account_settings_set_signature:
313  * @settings: a #ModestAccountSettings
314  * @hostname: a string.
315  *
316  * set @signature for the account .
317  */
318 void         modest_account_settings_set_signature (ModestAccountSettings *settings,
319                                                    const gchar *signature);
320 /**
321  * modest_account_settings_get_leave_messages_on_server:
322  * @settings: a #ModestAccountSettings
323  *
324  * obtains whether messages should be left on server or not
325  *
326  * Returns: a #gboolean
327  */
328 gboolean modest_account_settings_get_leave_messages_on_server (ModestAccountSettings *settings);
329                                               
330 /**
331  * modest_account_settings_set_leave_messages_on_server:
332  * @settings: a #ModestAccountSettings
333  * @leave_messages_on_server: a #gboolean
334  *
335  * set if we leave the messages on server or not.
336  */
337 void modest_account_settings_set_leave_messages_on_server (ModestAccountSettings *settings, 
338                                                            gboolean leave_messages_on_server);
339
340
341 /**
342  * modest_account_settings_get_use_connection_specific_smtp:
343  * @settings: a #ModestAccountSettings
344  *
345  * obtains if we should try the connection specific smtp servers
346  *
347  * Returns: a #gboolean
348  */
349 gboolean modest_account_settings_get_use_connection_specific_smtp (ModestAccountSettings *settings);
350                                               
351 /**
352  * modest_account_settings_set_use_connection_specific_smtp:
353  * @settings: a #ModestAccountSettings
354  * @use_connection_specific_smtp: a #gboolean
355  *
356  * if set, mails sent from this account first try the connection specific smtp servers
357  * before the transport account.
358  */
359 void modest_account_settings_set_use_connection_specific_smtp (ModestAccountSettings *settings, 
360                                                                gboolean use_connection_specific_smtp);
361
362 G_END_DECLS
363
364 #endif /* __MODEST_ACCOUNT_SETTINGS_H__ */