[evolution-data-server] Bug 775699 - Only latest 100 tasks downloaded from the Google
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Bug 775699 - Only latest 100 tasks downloaded from the Google
- Date: Thu, 8 Dec 2016 16:24:20 +0000 (UTC)
commit f87e020be895923b1f649841b4a880c08291419c
Author: Milan Crha <mcrha redhat com>
Date: Thu Dec 8 17:23:38 2016 +0100
Bug 775699 - Only latest 100 tasks downloaded from the Google
CMakeLists.txt | 16 +++++++++++++++
config.h.in | 5 +++-
.../backends/gtasks/e-cal-backend-gtasks.c | 21 ++++++++++++++++++-
3 files changed, 39 insertions(+), 3 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a6abef6..76ae7f8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -776,6 +776,22 @@ add_printable_option(ENABLE_GOOGLE "Enable Google support" ON)
if(ENABLE_GOOGLE)
pkg_check_modules_for_option(ENABLE_GOOGLE "Google" LIBGDATA libgdata>=${libgdata_minimum_version})
set(HAVE_LIBGDATA ON)
+
+ set(CMAKE_REQUIRED_DEFINITIONS ${LIBGDATA_CFLAGS_OTHER})
+ set(CMAKE_REQUIRED_INCLUDES ${LIBGDATA_INCLUDE_DIRS})
+ set(CMAKE_REQUIRED_LIBRARIES ${LIBGDATA_LDFLAGS})
+
+ CHECK_C_SOURCE_COMPILES("#include <gdata/gdata.h>
+ int main(void) {
+ const gchar *next_page_token;
+ next_page_token = gdata_feed_get_next_page_token (NULL);
+ gdata_tasks_query_set_page_token (NULL, next_page_token);
+ return 0;
+ }" HAVE_LIBGDATA_TASKS_PAGINATION_FUNCTIONS)
+
+ unset(CMAKE_REQUIRED_DEFINITIONS)
+ unset(CMAKE_REQUIRED_INCLUDES)
+ unset(CMAKE_REQUIRED_LIBRARIES)
endif(ENABLE_GOOGLE)
# ******************************
diff --git a/config.h.in b/config.h.in
index 549804f..ba1c33e 100644
--- a/config.h.in
+++ b/config.h.in
@@ -177,9 +177,12 @@
/* libical provides icaltzutil_set_exact_vtimezones_support function */
#cmakedefine HAVE_ICALTZUTIL_SET_EXACT_VTIMEZONES_SUPPORT 1
-/* Define to 1 if you have the libgdata package. */
+/* Define to 1 if you have the libgdata package */
#cmakedefine HAVE_LIBGDATA 1
+/* Define to 1 when the libgdata provides GTasks pagination functions */
+#cmakedefine HAVE_LIBGDATA_TASKS_PAGINATION_FUNCTIONS 1
+
/* Define to 1 when have O_LARGEFILE open flag */
#cmakedefine HAVE_O_LARGEFILE 1
diff --git a/src/calendar/backends/gtasks/e-cal-backend-gtasks.c
b/src/calendar/backends/gtasks/e-cal-backend-gtasks.c
index 2a3f35f..8adc520 100644
--- a/src/calendar/backends/gtasks/e-cal-backend-gtasks.c
+++ b/src/calendar/backends/gtasks/e-cal-backend-gtasks.c
@@ -445,8 +445,7 @@ ecb_gtasks_update_thread (gpointer user_data)
cancellable = ecb_gtasks_ref_cancellable (gtasks);
tasks_query = gdata_tasks_query_new (NULL);
- gdata_query_set_start_index (GDATA_QUERY (tasks_query), 0);
- gdata_query_set_max_results (GDATA_QUERY (tasks_query), G_MAXINT);
+ gdata_query_set_max_results (GDATA_QUERY (tasks_query), 100);
gdata_tasks_query_set_show_completed (tasks_query, TRUE);
gdata_tasks_query_set_show_hidden (tasks_query, TRUE);
@@ -461,7 +460,12 @@ ecb_gtasks_update_thread (gpointer user_data)
if (!local_error)
e_backend_ensure_source_status_connected (E_BACKEND (gtasks));
+#ifdef HAVE_LIBGDATA_TASKS_PAGINATION_FUNCTIONS
+ while (feed && !g_cancellable_is_cancelled (cancellable) && !local_error) {
+ const gchar *next_page_token;
+#else
if (feed) {
+#endif
GList *link;
const gchar *uid;
@@ -532,6 +536,19 @@ ecb_gtasks_update_thread (gpointer user_data)
e_cal_backend_store_thaw_changes (gtasks->priv->store);
PROPERTY_UNLOCK (gtasks);
+
+#ifdef HAVE_LIBGDATA_TASKS_PAGINATION_FUNCTIONS
+ next_page_token = gdata_feed_get_next_page_token (feed);
+ if (!next_page_token || !*next_page_token)
+ break;
+
+ gdata_tasks_query_set_page_token (tasks_query, next_page_token);
+
+ g_clear_object (&feed);
+
+ feed = gdata_tasks_service_query_tasks (gtasks->priv->service, gtasks->priv->tasklist,
+ GDATA_QUERY (tasks_query), cancellable, NULL, NULL, &local_error);
+#endif
}
g_clear_object (&tasks_query);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]