diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/config.c | 37 | ||||
-rw-r--r-- | src/config.h | 2 |
2 files changed, 30 insertions, 9 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); } diff --git a/src/config.h b/src/config.h index a5a7bdc..20254e9 100644 --- a/src/config.h +++ b/src/config.h @@ -42,7 +42,7 @@ mq_config_get_boolean(MqConfig *config, const gchar *name); gint mq_config_get_integer(MqConfig *config, const gchar *name); -gboolean +gdouble mq_config_get_double(MqConfig *config, const gchar *name); void |