[libgdata/wip/rishi/drive: 1/3] core: Parse selfLink from JSON for GDataFeed



commit 9b43a1768d05dd924c7267973684a27b9997430a
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Apr 23 14:25:18 2015 +0200

    core: Parse selfLink from JSON for GDataFeed
    
    https://bugzilla.gnome.org/show_bug.cgi?id=684920

 gdata/gdata-feed.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/gdata/gdata-feed.c b/gdata/gdata-feed.c
index 9bc9a25..41a4b0e 100644
--- a/gdata/gdata-feed.c
+++ b/gdata/gdata-feed.c
@@ -2,6 +2,7 @@
 /*
  * GData Client
  * Copyright (C) Philip Withnall 2008–2010 <philip tecnocode co uk>
+ * Copyright (C) Red Hat, Inc. 2015
  *
  * GData Client is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -625,6 +626,19 @@ parse_json (GDataParsable *parsable, JsonReader *reader, gpointer user_data, GEr
 
                        json_reader_end_element (reader);
                }
+       } else if (g_strcmp0 (json_reader_get_member_name (reader), "selfLink") == 0) {
+               GDataLink *_link;
+               const gchar *uri;
+
+               /* Empty URI? */
+               uri = json_reader_get_string_value (reader);
+               if (uri == NULL || *uri == '\0') {
+                       return gdata_parser_error_required_json_content_missing (reader, error);
+               }
+
+               _link = gdata_link_new (uri, GDATA_LINK_SELF);
+               _gdata_feed_add_link (self, _link);
+               g_object_unref (_link);
        } else if (g_strcmp0 (json_reader_get_member_name (reader), "kind") == 0) {
                /* Ignore. */
        } else if (g_strcmp0 (json_reader_get_member_name (reader), "etag") == 0) {


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