[evolution-data-server/gnome-3-22] 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/gnome-3-22] Bug 775699 - Only latest 100 tasks downloaded from the Google
- Date: Thu, 8 Dec 2016 16:27:59 +0000 (UTC)
commit abe0188a16aadeaf2ced9037fe86c6c2e2649cd1
Author: Milan Crha <mcrha redhat com>
Date: Thu Dec 8 17:27:28 2016 +0100
Bug 775699 - Only latest 100 tasks downloaded from the Google
calendar/backends/gtasks/e-cal-backend-gtasks.c | 21 +++++++++++++++++++--
configure.ac | 11 +++++++++++
2 files changed, 30 insertions(+), 2 deletions(-)
---
diff --git a/calendar/backends/gtasks/e-cal-backend-gtasks.c b/calendar/backends/gtasks/e-cal-backend-gtasks.c
index b73542a..20f147a 100644
--- a/calendar/backends/gtasks/e-cal-backend-gtasks.c
+++ b/calendar/backends/gtasks/e-cal-backend-gtasks.c
@@ -447,8 +447,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);
@@ -463,7 +462,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;
@@ -534,6 +538,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);
diff --git a/configure.ac b/configure.ac
index e2bbb76..56f7ac7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1612,6 +1612,17 @@ if test "x$enable_google" = xyes; then
if `$PKG_CONFIG --atleast-version=0.15.1 libgdata`; then
have_gdata_0_15_1=yes
fi
+
+ AC_MSG_CHECKING([for libgdata GTasks pagination functions])
+ save_cflags=$CFLAGS; CFLAGS="$GDATA_CFLAGS"
+ save_libs=$LIBS; LIBS="$GDATA_LIBS"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM(
+ [[#include <gdata/gdata.h>]],
+ [[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);]])],
+ [AC_DEFINE(HAVE_LIBGDATA_TASKS_PAGINATION_FUNCTIONS, 1, [Define to 1 when the libgdata
provides GTasks pagination functions]) ac_cv_have_gdgtpf=yes],[ac_cv_have_gdgtpf=no])
+ CFLAGS=$save_cflags
+ LIBS=$save_libs
+ AC_MSG_RESULT([$ac_cv_have_gdgtpf])
fi
AM_CONDITIONAL(HAVE_GOOGLE, [test x$enable_google = xyes])
AM_CONDITIONAL(HAVE_GDATA_0_15_1, [test x$have_gdata_0_15_1 = xyes])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]