summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <philip.withnall@collabora.co.uk>2015-07-08 09:46:15 +0100
committerPhilip Withnall <philip.withnall@collabora.co.uk>2015-07-08 09:46:15 +0100
commit6d66dcb54b4919a3a0f7cb1600c218e0199bfa1f (patch)
treedccf26b6cec43b70da08a1bba837a25580be585d
parent34d139a4d7b036c4bb65cb66c594ff4957e8a056 (diff)
downloadlibgdata-6d66dcb54b4919a3a0f7cb1600c218e0199bfa1f.tar.gz
app: Fix parsing of YouTube categories
The GDataAPPCategories parser used to take in the GType of the GDataCategory subclass to construct when parsing its category list; in the port to JSON, it was accidentally changed to always construct GDataCategory instances. This broke the YouTube code, which was hoping to see GDataYouTubeCategory instances be constructed.
-rw-r--r--gdata/app/gdata-app-categories.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gdata/app/gdata-app-categories.c b/gdata/app/gdata-app-categories.c
index 6fbf5f67..84a23a82 100644
--- a/gdata/app/gdata-app-categories.c
+++ b/gdata/app/gdata-app-categories.c
@@ -146,6 +146,10 @@ parse_json (GDataParsable *parsable, JsonReader *reader, gpointer user_data, GEr
{
GDataAPPCategories *self = GDATA_APP_CATEGORIES (parsable);
GDataAPPCategoriesPrivate *priv = self->priv;
+ GType category_type;
+
+ category_type = (user_data == NULL) ?
+ GDATA_TYPE_CATEGORY : GPOINTER_TO_SIZE (user_data);
if (g_strcmp0 (json_reader_get_member_name (reader), "items") == 0) {
guint i, elements;
@@ -177,7 +181,10 @@ parse_json (GDataParsable *parsable, JsonReader *reader, gpointer user_data, GEr
}
/* Create the category. */
- category = gdata_category_new (id, NULL, title);
+ category = g_object_new (category_type,
+ "term", id,
+ "label", title,
+ NULL);
priv->categories = g_list_prepend (priv->categories,
category);