diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/config.c | 30 | ||||
-rw-r--r-- | src/config.h | 6 |
2 files changed, 21 insertions, 15 deletions
diff --git a/src/config.c b/src/config.c index 97f8429..cf2d154 100644 --- a/src/config.c +++ b/src/config.c @@ -82,19 +82,6 @@ set_type_or_run_callbacks(MqConfig *config, const gchar *name, gpointer value, } static void -set_boolean(MqConfig *config, const gchar *name, gboolean value) -{ - gchar *group; - gchar *key; - - split_name(name, &group, &key); - - g_key_file_set_boolean(config->key_file, group, name, value); - - set_type_or_run_callbacks(config, name, &value, TYPE_BOOLEAN); -} - -static void set_defaults(MqConfig *config) { config->types_and_cbs_set = FALSE; @@ -136,6 +123,19 @@ mq_config_save(MqConfig *config) } void +mq_config_set_boolean(MqConfig *config, const gchar *name, gboolean value) +{ + gchar *group; + gchar *key; + + split_name(name, &group, &key); + + g_key_file_set_boolean(config->key_file, group, name, value); + + set_type_or_run_callbacks(config, name, &value, TYPE_BOOLEAN); +} + +void mq_config_set(MqConfig *config, const gchar *name, const gchar *value) { struct item *item; @@ -147,8 +147,8 @@ mq_config_set(MqConfig *config, const gchar *name, const gchar *value) case TYPE_BOOLEAN: /* value is "on" or "off" (as implemented in * mq_html_input_checkbox()). */ - set_boolean(config, name, value[1] == 'n' ? TRUE : - FALSE); + mq_config_set_boolean(config, name, + value[1] == 'n' ? TRUE : FALSE); break; } } diff --git a/src/config.h b/src/config.h index 281319f..f7e285c 100644 --- a/src/config.h +++ b/src/config.h @@ -33,4 +33,10 @@ struct MqConfig { GHashTable *types_and_cbs; }; +MqConfig * +mq_config_new(const gchar *profile); + +void +mq_config_set_boolean(MqConfig *config, const gchar *name, gboolean value); + #endif |