From: Dirk-Jan C. Binnema Date: Tue, 11 Jul 2006 16:13:32 +0000 (+0000) Subject: * added modest_conf_key_escape and modest_conf_key_unescape, to X-Git-Tag: git_migration_finished~4518 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=d95c7041b38e519a34fb756fe4483f2a731839d6 * added modest_conf_key_escape and modest_conf_key_unescape, to escape strings to valid gconf key names. pmo-trunk-r358 --- diff --git a/src/modest-conf.c b/src/modest-conf.c index d878028..5e7f894 100644 --- a/src/modest-conf.c +++ b/src/modest-conf.c @@ -28,6 +28,7 @@ */ #include +#include #include "modest-conf.h" #include "modest-marshal.h" @@ -318,6 +319,22 @@ modest_conf_key_exists (ModestConf* self, const gchar* key, GError **err) } +gchar* +modest_conf_key_escape (ModestConf *self, const gchar* key) +{ + g_return_val_if_fail (key, NULL); + + return gconf_escape_key (key, strlen(key)); +} + + +gchar* +modest_conf_key_unescape (ModestConf *self, const gchar* key) +{ + g_return_val_if_fail (key, NULL); + + return gconf_unescape_key (key, strlen(key)); +} diff --git a/src/modest-conf.h b/src/modest-conf.h index 895ee2b..f99e545 100644 --- a/src/modest-conf.h +++ b/src/modest-conf.h @@ -216,6 +216,31 @@ gboolean modest_conf_remove_key (ModestConf* self, const gchar* key, GError gboolean modest_conf_key_exists (ModestConf* self, const gchar* key, GError **err); +/** + * modest_conf_key_escape: + * @self: a ModestConf instance. Not used, but for consistency with other ModestConf funcs + * @str: a string to escape + * + * returns an escaped version of @str, ie. something suitable as a key + * + * Returns: a newly allocated string with the escaped version + */ +gchar* modest_conf_key_escape (ModestConf *self, const gchar* str); + + +/** + * modest_conf_key_escape: + * @self: a ModestConf instance. Not used, but for consistency with other ModestConf funcs + * @str: a string to escape + * + * returns an unescaped version of @str + * + * Returns: a newly allocated string with the unescaped version + */ +gchar* modest_conf_key_unescape (ModestConf *self, const gchar* str); + + + G_END_DECLS #endif /* __MODEST_CONF_H__ */