From 5c45b2fde79cec6276708e7068017e55d9c0ff67 Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Tue, 7 Oct 2008 18:57:22 +0000 Subject: Adjust SysInfoExtended parsing to the plist parser changes The type of the parsed data for nodes have changed in the plist parser, it's now a GValueArray, the SysInfoExtended parser has to take that into account since the description of the various artwork formats is stored in an element. git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@2137 f01d2545-417e-4e96-918e-98f8d0dbbcb6 --- ChangeLog | 6 ++++++ src/itdb_sysinfo_extended_parser.c | 24 +++++++++++------------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 32159f8..1c52c11 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-10-07 Christophe Fergeau + + * src/itdb_sysinfoextended_parser.c: artwork is stored in + nodes (which are parsed to a GValueArray), reflect that in the + SysInfoExtended parsing code. + 2008-10-07 Christophe Fergeau * src/itdb_plist.c: fix handling on blank nodes (ie nodes diff --git a/src/itdb_sysinfo_extended_parser.c b/src/itdb_sysinfo_extended_parser.c index a402eef..c00a868 100644 --- a/src/itdb_sysinfo_extended_parser.c +++ b/src/itdb_sysinfo_extended_parser.c @@ -450,31 +450,29 @@ static Itdb_ArtworkFormat *g_value_to_image_format (GValue *value) return img_spec; } -static void process_one (gpointer key, gpointer value, gpointer user_data) -{ - GList **img_formats = user_data; - Itdb_ArtworkFormat *format; - - format = g_value_to_image_format (value); - if (format != NULL) { - *img_formats = g_list_prepend (*img_formats, format); - } -} - static GList *parse_one_formats_list (GHashTable *sysinfo_dict, const char *key) { GValue *to_parse; GList *formats = NULL; + GValueArray *array; + gint i; to_parse = g_hash_table_lookup (sysinfo_dict, key); if (to_parse == NULL) { return NULL; } - if (!G_VALUE_HOLDS (to_parse, G_TYPE_HASH_TABLE)) { + if (!G_VALUE_HOLDS (to_parse, G_TYPE_VALUE_ARRAY)) { return NULL; } - g_hash_table_foreach (g_value_get_boxed (to_parse), process_one, &formats); + array = (GValueArray*)g_value_get_boxed (to_parse); + for (i = 0; i < array->n_values; i++) { + Itdb_ArtworkFormat *format; + format = g_value_to_image_format (g_value_array_get_nth (array, i)); + if (format != NULL) { + formats = g_list_prepend (formats, format); + } + } g_hash_table_remove (sysinfo_dict, key); return formats; } -- cgit