summaryrefslogtreecommitdiffstats
path: root/eglib
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2008-05-16 12:35:02 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2008-05-16 12:35:02 +0000
commit7a7e09d564017f7f514f843996f9a0fb5fad5fd2 (patch)
tree80ec46e83ad1e8589405ece7664f4972db9f15d4 /eglib
parentdf5a118a2538f4ae7e3bf355d0c4def9f7dcc131 (diff)
Implement g_key_file_get_string_list
Diffstat (limited to 'eglib')
-rw-r--r--eglib/gmain.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/eglib/gmain.c b/eglib/gmain.c
index 27f168d5..3259a43e 100644
--- a/eglib/gmain.c
+++ b/eglib/gmain.c
@@ -1739,7 +1739,31 @@ gchar **g_key_file_get_string_list(GKeyFile *key_file, const gchar *group_name,
const gchar *key, gsize *length,
GError **error)
{
- return g_new0(gchar *, 1);
+ gchar *str, *item, **list;
+ int items = 0;
+
+ str = g_key_file_get_string(key_file, group_name, key, error);
+ if (!str)
+ return NULL;
+
+ items = 0;
+ list = g_new0(char *, 1);
+
+ item = strtok(str, ",");
+ while (item) {
+ items++;
+
+ list = g_renew(char *, list, items + 1);
+
+ list[items - 1] = g_strdup(item);
+ list[items] = NULL;
+
+ item = strtok(NULL, ",");
+ }
+
+ g_free(str);
+
+ return list;
}
/* GString */