[evolution-data-server/gnome-3-36] I#203 - Google book: Do not use progress callbacks in libgdata sync API



commit 9eb7ec09e5b7e72a9e5c35a7f1b583d56c891bc5
Author: Milan Crha <mcrha redhat com>
Date:   Mon Mar 30 18:03:02 2020 +0200

    I#203 - Google book: Do not use progress callbacks in libgdata sync API
    
    These are always delivered in the main thread, on idle, regardless
    the libgdata API being called is synchronous.
    
    Closes https://gitlab.gnome.org/GNOME/evolution-data-server/-/issues/203

 .../backends/google/e-book-backend-google.c        | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/src/addressbook/backends/google/e-book-backend-google.c 
b/src/addressbook/backends/google/e-book-backend-google.c
index 378be85b3..4597169eb 100644
--- a/src/addressbook/backends/google/e-book-backend-google.c
+++ b/src/addressbook/backends/google/e-book-backend-google.c
@@ -238,18 +238,13 @@ ebb_google_cache_update_group (EBookBackendGoogle *bbgoogle,
 }
 
 static void
-ebb_google_process_group (GDataEntry *entry,
-                         guint entry_key,
-                         guint entry_count,
-                         gpointer user_data)
+ebb_google_process_group (EBookBackendGoogle *bbgoogle,
+                         GDataEntry *entry)
 {
-       EBookBackendGoogle *bbgoogle = user_data;
        const gchar *uid, *system_group_id;
        gchar *name;
        gboolean is_deleted;
 
-       g_return_if_fail (E_IS_BOOK_BACKEND_GOOGLE (bbgoogle));
-
        uid = gdata_entry_get_id (entry);
        name = e_contact_sanitise_google_group_name (entry);
 
@@ -328,7 +323,7 @@ ebb_google_get_groups_locked_sync (EBookBackendGoogle *bbgoogle,
        /* Run the query synchronously */
        feed = gdata_contacts_service_query_groups (
                GDATA_CONTACTS_SERVICE (bbgoogle->priv->service),
-               query, cancellable, ebb_google_process_group, bbgoogle, &local_error);
+               query, cancellable, NULL, NULL, &local_error);
 
        if (with_time_constraint && bbgoogle->priv->groups_last_update.tv_sec != 0 && (
            g_error_matches (local_error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_BAD_QUERY_PARAMETER) ||
@@ -339,15 +334,22 @@ ebb_google_get_groups_locked_sync (EBookBackendGoogle *bbgoogle,
 
                feed = gdata_contacts_service_query_groups (
                        GDATA_CONTACTS_SERVICE (bbgoogle->priv->service),
-                       query, cancellable, ebb_google_process_group, bbgoogle, error);
+                       query, cancellable, NULL, NULL, error);
        } else if (local_error) {
                g_propagate_error (error, local_error);
        }
 
        success = feed != NULL;
 
-       if (success)
+       if (success) {
+               GList *link;
+
+               for (link = gdata_feed_get_entries (feed); link; link = g_list_next (link)) {
+                       ebb_google_process_group (bbgoogle, link->data);
+               }
+
                g_get_current_time (&bbgoogle->priv->groups_last_update);
+       }
 
        g_rec_mutex_unlock (&bbgoogle->priv->groups_lock);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]