After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 707477 - Fill in GDataCategory::label for GDataDocumentsDocument instances
Fill in GDataCategory::label for GDataDocumentsDocument instances
Status: RESOLVED FIXED
Product: libgdata
Classification: Platform
Component: Google Documents service
git master
Other All
: Normal normal
: ---
Assigned To: libgdata-maint
libgdata-maint
Depends on:
Blocks:
 
 
Reported: 2013-09-04 15:20 UTC by Debarshi Ray
Modified: 2014-03-05 23:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
core: Load extra attributes from ‘kind’ categories (5.25 KB, patch)
2014-03-05 23:48 UTC, Philip Withnall
committed Details | Review

Description Debarshi Ray 2013-09-04 15:20:29 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.
Comment 1 Philip Withnall 2014-03-05 23:48:27 UTC
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 2 Philip Withnall 2014-03-05 23:50:38 UTC
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(+)