diff options
author | Patrick McDermott <pj@pehjota.net> | 2017-10-04 17:48:08 (EDT) |
---|---|---|
committer | Patrick McDermott <pj@pehjota.net> | 2017-10-04 17:48:08 (EDT) |
commit | 700e2658c496d0bdb241fa8a32708bd4b613a729 (patch) | |
tree | 4a3e4d360cc4e502f4200ba5fa0b3ab2ded35503 | |
parent | 891435f53bf3b8f52e1161fc986f127d3343bf62 (diff) | |
download | marquee-700e2658c496d0bdb241fa8a32708bd4b613a729.zip marquee-700e2658c496d0bdb241fa8a32708bd4b613a729.tar.gz marquee-700e2658c496d0bdb241fa8a32708bd4b613a729.tar.bz2 |
src/config.[ch]: Expose static function as mq_config_set_boolean()
And declare mq_config_new() in src/config.h.
-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 |