diff options
author | Patrick McDermott <pj@pehjota.net> | 2017-10-06 00:38:25 (EDT) |
---|---|---|
committer | Patrick McDermott <pj@pehjota.net> | 2017-10-06 00:38:25 (EDT) |
commit | 839e0104e994bd4941693203fca39a659894bb57 (patch) | |
tree | a2bad1d1ff6bcfbbee77c7e44a3d2884bf7c766a | |
parent | 0a2ccb6513e4db3adaa107f8a76d48eb1b711a8a (diff) | |
download | marquee-839e0104e994bd4941693203fca39a659894bb57.zip marquee-839e0104e994bd4941693203fca39a659894bb57.tar.gz marquee-839e0104e994bd4941693203fca39a659894bb57.tar.bz2 |
mq_config_get_string_list(): New function
-rw-r--r-- | src/config.c | 18 | ||||
-rw-r--r-- | src/config.h | 3 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/config.c b/src/config.c index 5bff673..1fe29ba 100644 --- a/src/config.c +++ b/src/config.c @@ -282,6 +282,24 @@ mq_config_get_string(MqConfig *config, const gchar *name) return value; } +gchar ** +mq_config_get_string_list(MqConfig *config, const gchar *name) +{ + gchar *group; + gchar *key; + gchar **value; + + split_name(name, &group, &key); + + /* TODO: Handle value parsing errors? */ + value = g_key_file_get_string_list(config->key_file, group, key, NULL, + NULL); + + g_free(group); + + return value; +} + static void set_type_or_run_callbacks(MqConfig *config, const gchar *name, gconstpointer value, enum type type) diff --git a/src/config.h b/src/config.h index 3a28d9e..d76ab3b 100644 --- a/src/config.h +++ b/src/config.h @@ -61,6 +61,9 @@ mq_config_get_double(MqConfig *config, const gchar *name); gchar * mq_config_get_string(MqConfig *config, const gchar *name); +gchar ** +mq_config_get_string_list(MqConfig *config, const gchar *name); + void mq_config_set_boolean(MqConfig *config, const gchar *name, gboolean value); |