From 193dfa16bc8a8729d587bb8f04d545d91e3209a0 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Tue, 27 Jun 2017 09:15:55 +0200 Subject: [PATCH] [Config] quick hack to support lists in rasi configuration{} block. --- source/xrmoptions.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/source/xrmoptions.c b/source/xrmoptions.c index 05fef439..840cf37c 100644 --- a/source/xrmoptions.c +++ b/source/xrmoptions.c @@ -373,15 +373,32 @@ static gboolean __config_parser_set_property ( XrmOption *option, const Property { extern const char *PropertyTypeName[]; if ( option->type == xrm_String ) { - if ( p->type != P_STRING ) { + if ( p->type != P_STRING && p->type != P_LIST ) { *error = g_strdup_printf ( "Option: %s needs to be set with a string not a %s.", option->name, PropertyTypeName[p->type] ); return TRUE; } + gchar *value = NULL; + if ( p->type == P_LIST ) { + for ( GList *iter = p->value.list; iter != NULL; iter = g_list_next ( iter ) ) { + if ( value == NULL ) { + value = g_strdup ( (char *) ( iter->data ) ); + } + else { + char *nv = g_strjoin ( ",", value, (char *) ( iter->data ), NULL ); + g_free ( value ); + value = nv; + } + } + } + else { + value = g_strdup ( p->value.s ); + } + printf ( "set: %s\n", value ); if ( ( option )->mem != NULL ) { g_free ( option->mem ); option->mem = NULL; } - *( option->value.str ) = g_strdup ( p->value.s ); + *( option->value.str ) = value; // Memory ( option )->mem = *( option->value.str );