1 /* Copyright (c) 2008, Nokia Corporation
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
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.
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.
31 /* modest-account-settings.h */
33 #ifndef __MODEST_PROTOCOL_H__
34 #define __MODEST_PROTOCOL_H__
36 #include <glib-object.h>
37 #include <glib/gi18n.h>
41 /* convenience macros */
42 #define MODEST_TYPE_PROTOCOL (modest_protocol_get_type())
43 #define MODEST_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_PROTOCOL,ModestProtocol))
44 #define MODEST_PROTOCOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_PROTOCOL,ModestProtocolClass))
45 #define MODEST_IS_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_PROTOCOL))
46 #define MODEST_IS_PROTOCOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_PROTOCOL))
47 #define MODEST_PROTOCOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_PROTOCOL,ModestProtocolClass))
49 #define MODEST_PROTOCOL_TYPE_INVALID -1
51 typedef gchar * (*TranslationFunc) (gpointer userdata, va_list args);
53 typedef struct _ModestProtocol ModestProtocol;
54 typedef struct _ModestProtocolClass ModestProtocolClass;
56 typedef guint ModestProtocolType;
58 struct _ModestProtocol {
62 struct _ModestProtocolClass {
63 GObjectClass parent_class;
67 * modest_protocol_get_type:
69 * Returns: GType of the account store
71 GType modest_protocol_get_type (void) G_GNUC_CONST;
74 * modest_protocol_new:
76 * creates a new instance of #ModestProtocol
78 * Returns: a #ModestProtocol
80 ModestProtocol* modest_protocol_new (const gchar *name, const gchar *display_name);
83 * modest_protocol_get_name:
84 * @self: a #ModestProtocol
86 * get the protocol unique name (used for storing conf and identifying the protocol with a string)
90 const gchar* modest_protocol_get_name (ModestProtocol *self);
93 * modest_protocol_set_name:
94 * @self: a #ModestProtocol
95 * @name: the protocol unique name.
97 * set @name as the protocol unique name .
99 void modest_protocol_set_name (ModestProtocol *self,
102 * modest_protocol_get_display_name:
103 * @self: a #ModestProtocol
105 * get the display name for the protocol
109 const gchar* modest_protocol_get_display_name (ModestProtocol *self);
112 * modest_protocol_set_display_name:
113 * @settings: a #ModestProtocol
114 * @display_name: a string.
116 * set @display_name of the account.
118 void modest_protocol_set_display_name (ModestProtocol *protocol,
119 const gchar *display_name);
121 * modest_protocol_get_type_id:
122 * @self: a #ModestProtocol
124 * get the protocol type id.
126 * Returns: a #ModestProtocolType
128 ModestProtocolType modest_protocol_get_type_id (ModestProtocol *self);
131 * modest_protocol_get:
132 * @protocol: a #ModestProtocol
135 * obtains the value of @key for @protocol
140 modest_protocol_get (ModestProtocol *protocol,
144 * modest_protocol_set:
145 * @protocol: a #ModestProtocol
149 * sets @value as the value for @key in @protocol
152 modest_protocol_set (ModestProtocol *protocol,
153 const gchar *key, const gchar *value);
156 * modest_protocol_set_translation:
157 * @protocol: a #ModestProtocol
158 * @id: the id for the translation set
159 * @translation_func: the function used to obtain the translation
161 * sets @translation_func as the way to compose the translation for @id
164 modest_protocol_set_translation (ModestProtocol *protocol,
166 TranslationFunc translation_func,
168 GDestroyNotify data_destroy_func);
171 * modest_protocol_get_translation:
172 * @protocol: a @ModestProtocol
173 * @id: the id for the translation set
174 * @...: the parameters for the translation (pritntf style)
176 * applies the translation with parameters to obtain the full string expected.
178 * Returns: a newly allocated string
181 modest_protocol_get_translation (ModestProtocol *protocol,
186 * modest_protocol_va_get_translation:
187 * @protocol: a @ModestProtocol
188 * @id: the id for the translation set
189 * @args: a @va_list of the parameters for the translation
191 * applies the translation with parameters to obtain the full string expected.
193 * Returns: a newly allocated string
196 modest_protocol_va_get_translation (ModestProtocol *protocol,
202 #endif /* __MODEST_PROTOCOL_H__ */