GNOME Bugzilla – Bug 741345
Paging does not work
Last modified: 2014-12-13 10:50:20 UTC
Created attachment 292457 [details] Reproducer Trying to page through the contents of my Drive using gdata_documents_query_new_with_limits and gdata_query_next_page returns the same set of results every time.
Created attachment 292628 [details] [review] core: Use correct relation URI for next/previous feed links GDataLink enforces that all relations are proper URIs, prefixing iana.org to those which aren’t — so we need to do the same when calling gdata_feed_look_up_link().
Created attachment 292629 [details] [review] core: Eliminate unnecessary is_async argument from parser functions Instead, use g_main_context_invoke(), which guarantees to call the callback synchronously if the GMainContext is owned, and in an idle callback otherwise. This is exactly what we want for implementing callbacks which could come from this thread or a worker thread.
Created attachment 292630 [details] [review] core: Virtualise feed parsing in GDataService Split the bulk of feed parsing out into a virtual method on GDataService. This will allow subclasses of GDataService to implement service-specific tweaks to feed parsing, which is required for pagination handling with Google Documents. New API: • GDataServiceClass.parse_feed This does not break ABI — it consumes one of the struct’s expansion slots.
These are work-in-progress patches. I still need to handle termination of the pagination loop, which still isn’t working in Docs. The first patch should be all you need to get going for the moment though. I also need to include your reproducer as an example app in libgdata, since it’s pretty swish. Thanks!
(In reply to comment #4) > These are work-in-progress patches. I still need to handle termination of the > pagination loop, which still isn’t working in Docs. The first patch should be > all you need to get going for the moment though. I will try it out and see if I can figure out the termination condition. > I also need to include your reproducer as an example app in libgdata, since > it’s pretty swish. Thanks! Sure, feel free to use it whichever way you want to. I guess I will have to modify it to not perpetually go on in a while loop and instead stop when it is done.
Created attachment 292645 [details] [review] core: Use correct relation URI for next/previous feed links GDataLink enforces that all relations are proper URIs, prefixing iana.org to those which aren’t — so we need to do the same when calling gdata_feed_look_up_link().
Created attachment 292646 [details] [review] core: Eliminate unnecessary is_async argument from parser functions Instead, use g_main_context_invoke(), which guarantees to call the callback synchronously if the GMainContext is owned, and in an idle callback otherwise. This is exactly what we want for implementing callbacks which could come from this thread or a worker thread.
Created attachment 292647 [details] [review] core: Virtualise feed parsing in GDataService Split the bulk of feed parsing out into a virtual method on GDataService. This will allow subclasses of GDataService to implement service-specific tweaks to feed parsing, which is required for pagination handling with Google Documents. New API: • GDataServiceClass.parse_feed This does not break ABI — it consumes one of the struct’s expansion slots.
Created attachment 292648 [details] [review] core: Allow the GDataFeed type to be passed to _gdata_feed_new() This will be used internally later to support constructing custom empty feeds for pagination purposes.
Created attachment 292649 [details] [review] core: Explicitly support a final page in GDataQuery pagination The pagination model previously used by GDataQuery was to assume that the server would return an empty GDataFeed once the final page was passed by calling gdata_query_next_page(). Unfortunately, the Google Documents servers don’t do that — instead, they provide a next page URI in each GDataFeed, and don’t provide one on the final page. GDataQuery did not support this kind of explicit knowledge about the current page being the final one. Add support for it with a delightful set of hacky internal functions. Return a dummy empty feed from GDataService if passed a GDataQuery which is flagged as having reached the end of its pagination.
Created attachment 292650 [details] [review] documents: Handle final page pagination in GDataDocumentsService The Google Documents servers always return a next page URI in a GDataFeed unless on the final page of results, in which case no URI is returned. Pass that information through to the GDataQuery so that pagination works correctly for Google Documents.
Attachment 292645 [details] pushed as b74bc65 - core: Use correct relation URI for next/previous feed links Attachment 292646 [details] pushed as 52e05dd - core: Eliminate unnecessary is_async argument from parser functions Attachment 292647 [details] pushed as 1e5e699 - core: Virtualise feed parsing in GDataService Attachment 292648 [details] pushed as 18edbc4 - core: Allow the GDataFeed type to be passed to _gdata_feed_new() Attachment 292649 [details] pushed as b449554 - core: Explicitly support a final page in GDataQuery pagination Attachment 292650 [details] pushed as f08951e - documents: Handle final page pagination in GDataDocumentsService
rishi, would it be OK for me to commit your reproducer (attachment #292457 [details]) as a libgdata demo of how to use GOA and Google Docs? I’d make minor modifications, but it would mostly remain the same. Would you be OK with LGPLv2.1+?
Created attachment 292651 [details] [review] demos: Add a docs-list demo Adapted from a bug report reproducer program by Debarshi Ray, this lists all the documents in the user’s Google Documents account, getting the account information from GOA.
(In reply to comment #13) > rishi, would it be OK for me to commit your reproducer (attachment > #292457 [details]) as a libgdata demo of how to use GOA and Google > Docs? I’d make minor modifications, but it would mostly remain the > same. Would you be OK with LGPLv2.1+? I am fine with LGPLv2.1+. Feel free to do whatever you want with it.
Great, thanks. Committed! Attachment 292651 [details] pushed as d848eb3 - demos: Add a docs-list demo