From 700e2658c496d0bdb241fa8a32708bd4b613a729 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Wed, 04 Oct 2017 17:48:08 -0400 Subject: src/config.[ch]: Expose static function as mq_config_set_boolean() And declare mq_config_new() in src/config.h. --- 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 -- cgit v0.9.1