diff options
Diffstat (limited to 'src/config.c')
-rw-r--r-- | src/config.c | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/src/config.c b/src/config.c index 12b723e..19c06eb 100644 --- a/src/config.c +++ b/src/config.c @@ -139,13 +139,18 @@ mq_config_save(MqConfig *config) gboolean mq_config_get_boolean(MqConfig *config, const gchar *name) { - gchar *group; - gchar *key; + gchar *group; + gchar *key; + gboolean value; split_name(name, &group, &key); /* TODO: Handle value parsing errors? */ - return g_key_file_get_boolean(config->key_file, group, key, NULL); + value = g_key_file_get_boolean(config->key_file, group, key, NULL); + + g_free(group); + + return value; } gint @@ -153,23 +158,33 @@ mq_config_get_integer(MqConfig *config, const gchar *name) { gchar *group; gchar *key; + gint value; split_name(name, &group, &key); /* TODO: Handle value parsing errors? */ - return g_key_file_get_integer(config->key_file, group, key, NULL); + value = g_key_file_get_integer(config->key_file, group, key, NULL); + + g_free(group); + + return value; } -gboolean +gdouble mq_config_get_double(MqConfig *config, const gchar *name) { - gchar *group; - gchar *key; + gchar *group; + gchar *key; + gdouble value; split_name(name, &group, &key); /* TODO: Handle value parsing errors? */ - return g_key_file_get_double(config->key_file, group, key, NULL); + value = g_key_file_get_double(config->key_file, group, key, NULL); + + g_free(group); + + return value; } void @@ -182,6 +197,8 @@ mq_config_set_boolean(MqConfig *config, const gchar *name, gboolean value) g_key_file_set_boolean(config->key_file, group, key, value); + g_free(group); + set_type_or_run_callbacks(config, name, &value, TYPE_BOOLEAN); } @@ -195,6 +212,8 @@ mq_config_set_integer(MqConfig *config, const gchar *name, gint value) g_key_file_set_integer(config->key_file, group, key, value); + g_free(group); + set_type_or_run_callbacks(config, name, &value, TYPE_INTEGER); } @@ -208,6 +227,8 @@ mq_config_set_double(MqConfig *config, const gchar *name, gdouble value) g_key_file_set_double(config->key_file, group, key, value); + g_free(group); + set_type_or_run_callbacks(config, name, &value, TYPE_DOUBLE); } |