[libgdata] documents: Add support for paging through Drive v2 file lists
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgdata] documents: Add support for paging through Drive v2 file lists
- Date: Mon, 27 Apr 2015 12:00:10 +0000 (UTC)
commit fa3e219eff1d4617463a86deb14cb3b1f5fb9a19
Author: Debarshi Ray <debarshir gnome org>
Date: Fri Apr 24 11:35:22 2015 +0200
documents: Add support for paging through Drive v2 file lists
The server does not offer a ‘previous’ URI.
https://bugzilla.gnome.org/show_bug.cgi?id=684920
gdata/services/documents/gdata-documents-feed.c | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/gdata/services/documents/gdata-documents-feed.c b/gdata/services/documents/gdata-documents-feed.c
index 92b461e..2f7324e 100644
--- a/gdata/services/documents/gdata-documents-feed.c
+++ b/gdata/services/documents/gdata-documents-feed.c
@@ -123,10 +123,23 @@ get_kind_and_mime_type (JsonReader *reader, gchar **out_kind, gchar **out_mime_t
static gboolean
parse_json (GDataParsable *parsable, JsonReader *reader, gpointer user_data, GError **error)
{
+ gboolean success = TRUE;
+ gchar *next_uri = NULL;
+
/* JSON format: https://developers.google.com/drive/v2/reference/files/list */
- if (g_strcmp0 (json_reader_get_member_name (reader), "items") == 0) {
- gboolean success = TRUE;
+ if (gdata_parser_string_from_json_member (reader, "nextLink", P_DEFAULT, &next_uri, &success, error)
== TRUE) {
+ if (success && next_uri != NULL && next_uri[0] != '\0') {
+ GDataLink *_link;
+
+ _link = gdata_link_new (next_uri, "http://www.iana.org/assignments/relation/next");
+ _gdata_feed_add_link (GDATA_FEED (parsable), _link);
+ g_object_unref (_link);
+ }
+
+ g_free (next_uri);
+ return success;
+ } else if (g_strcmp0 (json_reader_get_member_name (reader), "items") == 0) {
guint i, elements;
if (json_reader_is_array (reader) == FALSE) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]