[evolution-data-server] [LDAP & Google] Use EBookBackendClass::refresh_sync method



commit 86f671163af4d7f0b349aba9ca269f299f0dab35
Author: Milan Crha <mcrha redhat com>
Date:   Thu May 22 15:34:28 2014 +0200

    [LDAP & Google] Use EBookBackendClass::refresh_sync method
    
    These backends used the old 'refresh' API, which is deprecated,
    thus replace it with a new API.

 .../backends/google/e-book-backend-google.c        |   18 +++++++---------
 addressbook/backends/ldap/e-book-backend-ldap.c    |   22 +++++++++----------
 2 files changed, 18 insertions(+), 22 deletions(-)
---
diff --git a/addressbook/backends/google/e-book-backend-google.c 
b/addressbook/backends/google/e-book-backend-google.c
index d7df7f4..d70cea6 100644
--- a/addressbook/backends/google/e-book-backend-google.c
+++ b/addressbook/backends/google/e-book-backend-google.c
@@ -2278,19 +2278,17 @@ book_backend_google_stop_view (EBookBackend *backend,
        }
 }
 
-static void
-book_backend_google_refresh (EBookBackend *backend,
-                             EDataBook *book,
-                             guint32 opid,
-                             GCancellable *cancellable)
+static gboolean
+book_backend_google_refresh_sync (EBookBackend *backend,
+                                 GCancellable *cancellable,
+                                 GError **error)
 {
-       g_return_if_fail (E_IS_BOOK_BACKEND_GOOGLE (backend));
-
-       /* stop immediately, nothing to report here */
-       e_data_book_respond_refresh (book, opid, NULL);
+       g_return_val_if_fail (E_IS_BOOK_BACKEND_GOOGLE (backend), FALSE);
 
        /* get only changes, it's not needed to redownload whole cache */
        get_new_contacts (backend);
+
+       return TRUE;
 }
 
 static ESourceAuthenticationResult
@@ -2372,7 +2370,7 @@ e_book_backend_google_class_init (EBookBackendGoogleClass *class)
        backend_class->get_contact_list_sync = book_backend_google_get_contact_list_sync;
        backend_class->start_view = book_backend_google_start_view;
        backend_class->stop_view = book_backend_google_stop_view;
-       backend_class->refresh = book_backend_google_refresh;
+       backend_class->refresh_sync = book_backend_google_refresh_sync;
 }
 
 static void
diff --git a/addressbook/backends/ldap/e-book-backend-ldap.c b/addressbook/backends/ldap/e-book-backend-ldap.c
index cedabc3..a2b2a05 100644
--- a/addressbook/backends/ldap/e-book-backend-ldap.c
+++ b/addressbook/backends/ldap/e-book-backend-ldap.c
@@ -4707,26 +4707,24 @@ generate_cache (EBookBackendLDAP *book_backend_ldap)
        }
 }
 
-static void
-book_backend_ldap_refresh (EBookBackend *backend,
-                           EDataBook *book,
-                           guint32 opid,
-                           GCancellable *cancellable)
+static gboolean
+book_backend_ldap_refresh_sync (EBookBackend *backend,
+                               GCancellable *cancellable,
+                               GError **error)
 {
        EBookBackendLDAP *ldap_backend = E_BOOK_BACKEND_LDAP (backend);
 
-       g_return_if_fail (ldap_backend != NULL);
-       g_return_if_fail (ldap_backend->priv != NULL);
-
-       /* stop immediately, nothing to report here */
-       e_data_book_respond_refresh (book, opid, NULL);
+       g_return_val_if_fail (ldap_backend != NULL, FALSE);
+       g_return_val_if_fail (ldap_backend->priv != NULL, FALSE);
 
        if (!ldap_backend->priv->cache || !ldap_backend->priv->marked_for_offline ||
            ldap_backend->priv->generate_cache_in_progress)
-               return;
+               return TRUE;
 
        e_book_backend_cache_set_time (ldap_backend->priv->cache, "");
        generate_cache (ldap_backend);
+
+       return TRUE;
 }
 
 static void
@@ -5856,7 +5854,7 @@ e_book_backend_ldap_class_init (EBookBackendLDAPClass *class)
        backend_class->get_contact_list_uids = book_backend_ldap_get_contact_list_uids;
        backend_class->start_view = book_backend_ldap_start_view;
        backend_class->stop_view = book_backend_ldap_stop_view;
-       backend_class->refresh = book_backend_ldap_refresh;
+       backend_class->refresh_sync = book_backend_ldap_refresh_sync;
 
        /* Register our ESource extension. */
        E_TYPE_SOURCE_LDAP;


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