[libgdata/wip/rishi/drive: 8/8] 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/wip/rishi/drive: 8/8] documents: Add support for paging through Drive v2 file lists
- Date: Thu, 23 Apr 2015 13:20:48 +0000 (UTC)
commit c11be25d4a23bfe200dff3e0186d4d1ff838eb0a
Author: Debarshi Ray <debarshir gnome org>
Date: Thu Apr 23 14:47:30 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 16cd147..2fcf381 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]