5 #ifndef __MODEST_CONF_H__
6 #define __MODEST_CONF_H__
8 #include <glib-object.h>
9 #include "modest-conf-keys.h"
13 /* convenience macros */
14 #define MODEST_TYPE_CONF (modest_conf_get_type())
15 #define MODEST_CONF(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_CONF,ModestConf))
16 #define MODEST_CONF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_CONF,GObject))
17 #define MODEST_IS_CONF(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_CONF))
18 #define MODEST_IS_CONF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_CONF))
19 #define MODEST_CONF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_CONF,ModestConfClass))
21 typedef struct _ModestConf ModestConf;
22 typedef struct _ModestConfClass ModestConfClass;
28 struct _ModestConfClass {
29 GObjectClass parent_class;
30 /* insert signal callback declarations, eg. */
31 /* void (* my_event) (ModestConf* obj); */
36 * modest_conf_get_type:
38 * get the GType for ModestConf
42 GType modest_conf_get_type (void) G_GNUC_CONST;
48 * create a new modest ModestConf object.
50 * Returns: a new ModestConf instance, or NULL in case
53 GObject* modest_conf_new (void);
57 * modest_conf_get_string:
58 * @self: self a ModestConf instance
59 * @key: the key of the value to retrieve
60 * @err: a GError ptr, or NULL to ignore.
62 * get a string from the configuration system
64 * Returns: a newly allocated string with the value for the key,
65 * or NULL in case of error. @err gives details in case of error
67 gchar* modest_conf_get_string (ModestConf* self, const gchar* key, GError **err);
71 * modest_conf_get_int:
72 * @self: self a ModestConf instance
73 * @key: the key of the value to retrieve
74 * @err: a GError ptr, or NULL to ignore.
76 * get an integer from the configuration system
78 * Returns: an integer with the value for the key, or -1 in case of error
79 * (of course, -1 can also be returned in non-error cases).
80 * @err gives details in case of error
82 int modest_conf_get_int (ModestConf* self, const gchar* key, GError **err);
86 * modest_conf_get_bool:
87 * @self: self a ModestConf instance
88 * @key: the key of the value to retrieve
89 * @err: a GError ptr, or NULL to ignore.
91 * get a boolean value from the configuration system
93 * Returns: a boolean value with the value for the key, or -1 in case of error
94 * (of course, -1 can also be returned in non-error cases).
95 * @err gives details in case of error
97 gboolean modest_conf_get_bool (ModestConf* self, const gchar* key, GError **err);
101 * modest_conf_set_string:
102 * @self: a ModestConf instance
103 * @key: the key of the value to set
104 * @val: the value to set
105 * @err: a GError ptr, or NULL if not interested.
107 * store a string value in the configuration system
109 * Returns: TRUE if succeeded or FALSE in case of error.
110 * @err gives details in case of error
112 gboolean modest_conf_set_string (ModestConf* self, const gchar* key, const gchar *val,
116 * modest_conf_set_int:
117 * @self: a ModestConf instance
118 * @key: the key of the value to set
119 * @val: the value to set
120 * @err: a GError ptr, or NULL if not interested.
122 * store an integer value in the configuration system
124 * Returns: TRUE if succeeded or FALSE in case of error.
125 * @err gives details in case of error
127 gboolean modest_conf_set_int (ModestConf* self, const gchar* key, int val,
131 * modest_conf_set_bool:
132 * @self: a ModestConf instance
133 * @key: the key of the value to set
134 * @val: the value to set
135 * @err: a GError ptr, or NULL if not interested.
137 * store a boolean value in the configuration system
139 * Returns: TRUE if succeeded or FALSE in case of error.
140 * @err gives details in case of error
142 gboolean modest_conf_set_bool (ModestConf* self, const gchar* key, gboolean val,
147 * modest_conf_list_subkeys:
148 * @self: a ModestConf instance
149 * @key: the key whose subkeys will be listed
150 * @err: a GError ptr, or NULL if not interested.
152 * list all the subkeys for a given key
154 * Returns: a newly allocated list or NULL in case of error
155 * the returned GSList must be freed by the caller
156 * @err gives details in case of error
158 GSList* modest_conf_list_subkeys (ModestConf* self, const gchar* key,
163 * modest_conf_remove_key:
164 * @self: a ModestConf instance
165 * @key: the key to remove
166 * @err: a GError ptr, or NULL if not interested.
168 * attempts to remove @key and all its subkeys
170 * Returns: TRUE if succeeded or FALSE in case of error.
171 * @err gives details in case of error
173 gboolean modest_conf_remove_key (ModestConf* self, const gchar* key, GError **err);
177 * modest_conf_key_exists:
178 * @self: a ModestConf instance
179 * @key: the key to remove
180 * @err: a GError ptr, or NULL if not interested.
182 * checks if the given key exists in the configuration system
184 * Returns: TRUE if exists, FALSE otherwise.
185 * @err gives details in case of error
187 gboolean modest_conf_key_exists (ModestConf* self, const gchar* key, GError **err);
192 #endif /* __MODEST_CONF_H__ */