diff options
-rw-r--r-- | src/config.c | 36 | ||||
-rw-r--r-- | src/config.h | 9 |
2 files changed, 45 insertions, 0 deletions
diff --git a/src/config.c b/src/config.c index d4de2af..b63e4a5 100644 --- a/src/config.c +++ b/src/config.c @@ -136,6 +136,42 @@ mq_config_save(MqConfig *config) NULL); } +gboolean +mq_config_get_boolean(MqConfig *config, const gchar *name) +{ + gchar *group; + gchar *key; + + split_name(name, &group, &key); + + /* TODO: Handle value parsing errors? */ + return g_key_file_get_boolean(config->key_file, group, key, NULL); +} + +gint +mq_config_get_integer(MqConfig *config, const gchar *name) +{ + gchar *group; + gchar *key; + + split_name(name, &group, &key); + + /* TODO: Handle value parsing errors? */ + return g_key_file_get_integer(config->key_file, group, key, NULL); +} + +gboolean +mq_config_get_double(MqConfig *config, const gchar *name) +{ + gchar *group; + gchar *key; + + split_name(name, &group, &key); + + /* TODO: Handle value parsing errors? */ + return g_key_file_get_double(config->key_file, group, key, NULL); +} + void mq_config_set_boolean(MqConfig *config, const gchar *name, gboolean value) { diff --git a/src/config.h b/src/config.h index 126e790..a5a7bdc 100644 --- a/src/config.h +++ b/src/config.h @@ -36,6 +36,15 @@ struct MqConfig { MqConfig * mq_config_new(const gchar *profile); +gboolean +mq_config_get_boolean(MqConfig *config, const gchar *name); + +gint +mq_config_get_integer(MqConfig *config, const gchar *name); + +gboolean +mq_config_get_double(MqConfig *config, const gchar *name); + void mq_config_set_boolean(MqConfig *config, const gchar *name, gboolean value); |