From 839e0104e994bd4941693203fca39a659894bb57 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Fri, 06 Oct 2017 00:38:25 -0400 Subject: mq_config_get_string_list(): New function --- (limited to 'src') 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); -- cgit v0.9.1