GNOME Bugzilla – Bug 707477
Fill in GDataCategory::label for GDataDocumentsDocument instances
Last modified: 2014-03-05 23:50:47 UTC
I have a ODP file in my Google Drive and these are the category nodes for it: <category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/docs/2007#file' label='application/vnd.oasis.opendocument.presentation'/> <category scheme='http://schemas.google.com/g/2005/labels' term='http://schemas.google.com/g/2005/labels#modified-by-me' label='modified-by-me'/> In the list of categories returned by gdata_entry_get_categories, the label for the first category is not set. Grepping through the code and playing with a few more files, it looks like the label is always set to NULL for 'kind term's. This is problematic because for such entries, only a GDataDocumentsDocument is created instead of one of the more specialized types. This is makes it hard for an application (eg., gnome-documents) to categorize it correctly as a presentation. Having the label property would let the application workaround the fact that this MIME type is treated as a 2nd class citizen by Google.
Created attachment 271051 [details] [review] core: Load extra attributes from ‘kind’ categories When a GDataEntry is created, it’s automatically given a ‘kind’ category element, as this is the way the GData protocol identifies the schema which applies to a given <entry>. Previously, the ‘kind’ category from parsed XML would not override the automatically-added category. This meant that if the XML contained extra attributes, such as a label, they were effectively lost. Fix this by always preferring the ‘kind’ category from the XML. Add a test case, because test cases are cool.
Comment on attachment 271051 [details] [review] core: Load extra attributes from ‘kind’ categories Fixed. Sorry for the wait. commit 1ea060993046662974f90a22cbf3094c142ee199 Author: Philip Withnall <philip@tecnocode.co.uk> Date: Wed Mar 5 23:46:30 2014 +0000 core: Load extra attributes from ‘kind’ categories When a GDataEntry is created, it’s automatically given a ‘kind’ category element, as this is the way the GData protocol identifies the schema which applies to a given <entry>. Previously, the ‘kind’ category from parsed XML would not override the automatically-added category. This meant that if the XML contained extra attributes, such as a label, they were effectively lost. Fix this by always preferring the ‘kind’ category from the XML. Add a test case, because test cases are cool. https://bugzilla.gnome.org/show_bug.cgi?id=707477 gdata/gdata-entry.c | 14 ++++++++++++++ gdata/tests/general.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+)