Show a generic error (instead of the one from Tinymail) when
[modest] / src / modest-server-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-server-account-settings.h */
32
33 #ifndef __MODEST_SERVER_ACCOUNT_SETTINGS_H__
34 #define __MODEST_SERVER_ACCOUNT_SETTINGS_H__
35
36 #include <glib-object.h>
37 #include <modest-defs.h>
38 #include <modest-protocol-info.h>
39
40 G_BEGIN_DECLS
41
42 /* convenience macros */
43 #define MODEST_TYPE_SERVER_ACCOUNT_SETTINGS             (modest_server_account_settings_get_type())
44 #define MODEST_SERVER_ACCOUNT_SETTINGS(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_SERVER_ACCOUNT_SETTINGS,ModestServerAccountSettings))
45 #define MODEST_SERVER_ACCOUNT_SETTINGS_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_SERVER_ACCOUNT_SETTINGS,ModestServerAccountSettingsClass))
46 #define MODEST_IS_SERVER_ACCOUNT_SETTINGS(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_SERVER_ACCOUNT_SETTINGS))
47 #define MODEST_IS_SERVER_ACCOUNT_SETTINGS_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_SERVER_ACCOUNT_SETTINGS))
48 #define MODEST_SERVER_ACCOUNT_SETTINGS_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_SERVER_ACCOUNT_SETTINGS,ModestServerAccountSettingsClass))
49
50 typedef struct _ModestServerAccountSettings      ModestServerAccountSettings;
51 typedef struct _ModestServerAccountSettingsClass ModestServerAccountSettingsClass;
52
53 struct _ModestServerAccountSettings {
54         GObject parent;
55 };
56
57 struct _ModestServerAccountSettingsClass {
58         GObjectClass parent_class;
59 };
60
61
62 /**
63  * modest_server_account_settings_get_type:
64  *
65  * Returns: GType of the account store
66  */
67 GType  modest_server_account_settings_get_type   (void) G_GNUC_CONST;
68
69 /**
70  * modest_server_account_settings_new:
71  *
72  * creates a new instance of #ModestServerAccountSettings
73  *
74  * Returns: a #ModestServerAccountSettings
75  */
76 ModestServerAccountSettings*    modest_server_account_settings_new (void);
77
78 /**
79  * modest_server_account_settings_get_hostname:
80  * @settings: a #ModestServerAccountSettings
81  *
82  * get the server hostname.
83  *
84  * Returns: a string
85  */
86 const gchar* modest_server_account_settings_get_hostname (ModestServerAccountSettings *settings);
87
88 /**
89  * modest_server_account_settings_set_hostname:
90  * @settings: a #ModestServerAccountSettings
91  * @hostname: a string.
92  *
93  * set @hostname as the server hostname.
94  */
95 void         modest_server_account_settings_set_hostname (ModestServerAccountSettings *settings,
96                                                                       const gchar *hostname);
97
98 /**
99  * modest_server_account_settings_get_protocol:
100  * @settings: a #ModestServerAccountSettings
101  *
102  * get the server protocol.
103  *
104  * Returns: a #ModestTransportStoreProtocol
105  */
106 ModestTransportStoreProtocol  modest_server_account_settings_get_protocol (ModestServerAccountSettings *settings);
107
108 /**
109  * modest_server_account_settings_set_protocol:
110  * @settings: a #ModestServerAccountSettings
111  * @protocol: a #ModestTransportStoreProtocol.
112  *
113  * set @server_type.
114  */
115 void                          modest_server_account_settings_set_protocol (ModestServerAccountSettings *settings,
116                                                                            ModestTransportStoreProtocol protocol);
117
118
119 /**
120  * modest_server_account_settings_get_uri:
121  * @settings: a #ModestServerAccountSettings
122  *
123  * get the uri, if any. If this is set, then all the other fields are invalid. It's only valid if protocol is %NULL.
124  *
125  * Returns: a string
126  */
127 const gchar *modest_server_account_settings_get_uri (ModestServerAccountSettings *settings);
128
129 /**
130  * modest_server_account_settings_set_uri:
131  * @settings: a #ModestServerAccountSettings
132  * @uri: a string
133  *
134  * set @uri. When you set an @uri, then the protocol is set to %NULL. This is used for setting maildir or mbox
135  * accounts.
136  */
137 void   modest_server_account_settings_set_uri (ModestServerAccountSettings *settings,
138                                                const gchar *uri);
139
140 /**
141  * modest_server_account_settings_get_port:
142  * @settings: a #ModestServerAccountSettings
143  *
144  * get the server port.
145  *
146  * Returns: a #guint
147  */
148 guint  modest_server_account_settings_get_port (ModestServerAccountSettings *settings);
149
150 /**
151  * modest_server_account_settings_set_port:
152  * @settings: a #ModestServerAccountSettings
153  * @port: a #guint.
154  *
155  * set @port.
156  */
157 void   modest_server_account_settings_set_port (ModestServerAccountSettings *settings,
158                                                 guint port);
159
160 /**
161  * modest_server_account_settings_get_username:
162  * @settings: a #ModestServerAccountSettings
163  *
164  * get the username.
165  *
166  * Returns: a string
167  */
168 const gchar *modest_server_account_settings_get_username (ModestServerAccountSettings *settings);
169
170 /**
171  * modest_server_account_settings_set_username:
172  * @settings: a #ModestServerAccountSettings
173  * @username: a string
174  *
175  * set @username.
176  */
177 void   modest_server_account_settings_set_username (ModestServerAccountSettings *settings,
178                                                     const gchar *username);
179
180 /**
181  * modest_server_account_settings_get_password:
182  * @settings: a #ModestServerAccountSettings
183  *
184  * get the password.
185  *
186  * Returns: a string
187  */
188 const gchar *modest_server_account_settings_get_password (ModestServerAccountSettings *settings);
189
190 /**
191  * modest_server_account_settings_set_password:
192  * @settings: a #ModestServerAccountSettings
193  * @password: a string
194  *
195  * set @password.
196  */
197 void   modest_server_account_settings_set_password (ModestServerAccountSettings *settings,
198                                                     const gchar *password);
199
200
201 /**
202  * modest_server_account_settings_get_security:
203  * @settings: a #ModestServerAccountSettings
204  *
205  * get the secure connection type, if any.
206  *
207  * Returns: a #ModestConnectionProtocol
208  */
209 ModestConnectionProtocol modest_server_account_settings_get_security (ModestServerAccountSettings *settings);
210
211 /**
212  * modest_server_account_settings_set_security:
213  * @settings: a #ModestServerAccountSettings
214  * @security: a #ModestConnectionProtocol
215  *
216  * set the current security connection protocol to @security.
217  */
218 void   modest_server_account_settings_set_security (ModestServerAccountSettings *settings,
219                                                     ModestConnectionProtocol security);
220
221
222 /**
223  * modest_server_account_settings_get_auth_protocol:
224  * @settings: a #ModestServerAccountSettings
225  *
226  * get the authentication protocol
227  *
228  * Returns: a #ModestAuthProtocol
229  */
230 ModestAuthProtocol modest_server_account_settings_get_auth_protocol (ModestServerAccountSettings *settings);
231
232 /**
233  * modest_server_account_settings_set_auth_protocol:
234  * @settings: a #ModestServerAccountSettings
235  * @auth_protocol: a #ModestAuthProtocol
236  *
237  * set the current authentication protocol to @auth_protocol.
238  */
239 void   modest_server_account_settings_set_auth_protocol (ModestServerAccountSettings *settings,
240                                                          ModestAuthProtocol auth_protocol);
241
242 /**
243  * modest_server_account_settings_get_account_name:
244  * @settings: a #ModestServerAccountSettings
245  *
246  * get the #ModestAccountMgr account name for these settings, or
247  * %NULL if it's not in the manager.
248  *
249  * Returns: a string, or %NULL
250  */
251 const gchar *modest_server_account_settings_get_account_name (ModestServerAccountSettings *settings);
252
253 /**
254  * modest_server_account_settings_set_account_name:
255  * @settings: a #ModestServerAccountSettings
256  * @account_name: a string
257  *
258  * sets the account name that will be used to store the account settings. This should
259  * only be called from #ModestAccountMgr and #ModestAccountSettings.
260  */
261 void modest_server_account_settings_set_account_name (ModestServerAccountSettings *settings,
262                                                       const gchar *account_name);
263
264
265 G_END_DECLS
266
267 #endif /* __MODEST_SERVER_ACCOUNT_SETTINGS_H__ */