[libgdata] documents: Parse quotaBytesUsed as GDataDocumentsEntry:quota-used



commit 840eea2f26fb8de25d8bc0b9a1e4ca57f50fd660
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Sep 2 18:55:09 2015 +0200

    documents: Parse quotaBytesUsed as GDataDocumentsEntry:quota-used
    
    https://bugzilla.gnome.org/show_bug.cgi?id=684920

 gdata/services/documents/gdata-documents-entry.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/gdata/services/documents/gdata-documents-entry.c 
b/gdata/services/documents/gdata-documents-entry.c
index a459bd6..006926a 100644
--- a/gdata/services/documents/gdata-documents-entry.c
+++ b/gdata/services/documents/gdata-documents-entry.c
@@ -570,6 +570,7 @@ parse_json (GDataParsable *parsable, JsonReader *reader, gpointer user_data, GEr
        gboolean success = TRUE;
        gchar *alternate_uri = NULL;
        gchar *kind = NULL;
+       gchar *quota_used = NULL;
        gint64 published;
        gint64 updated;
 
@@ -607,6 +608,18 @@ parse_json (GDataParsable *parsable, JsonReader *reader, gpointer user_data, GEr
                if (success)
                        _gdata_entry_set_updated (GDATA_ENTRY (parsable), updated);
                return success;
+       } else if (gdata_parser_string_from_json_member (reader, "quotaBytesUsed", P_DEFAULT, &quota_used, 
&success, error) == TRUE) {
+               gchar *end_ptr;
+               guint64 val;
+
+               /* Even though ‘quotaBytesUsed’ is documented as long,
+                * it is actually a string in the JSON.
+                */
+               val = g_ascii_strtoull (quota_used, &end_ptr, 10);
+               if (*end_ptr == '\0')
+                       priv->quota_used = (goffset) val;
+               g_free (quota_used);
+               return success;
        } else if (gdata_parser_boolean_from_json_member (reader, "shared", P_DEFAULT, &shared, &success, 
error) == TRUE) {
                if (success && shared) {
                        category = gdata_category_new ("http://schemas.google.com/g/2005/labels#shared";, 
GDATA_CATEGORY_SCHEMA_LABELS, "shared");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]