From c587590cc7f7825857d5429a6b2da6b6bf1ea05a Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 31 Jul 2012 18:07:02 -0400 Subject: [PATCH] Use e_backend_authenticate_sync() in backends. --- addressbook/backends/google/e-book-backend-google.c | 9 +++------ addressbook/backends/ldap/e-book-backend-ldap.c | 7 ++----- addressbook/backends/webdav/e-book-backend-webdav.c | 7 ++----- calendar/backends/caldav/e-cal-backend-caldav.c | 14 +++++--------- calendar/backends/http/e-cal-backend-http.c | 9 ++------- 5 files changed, 14 insertions(+), 32 deletions(-) diff --git a/addressbook/backends/google/e-book-backend-google.c b/addressbook/backends/google/e-book-backend-google.c index 9b0c6b9..1593327 100644 --- a/addressbook/backends/google/e-book-backend-google.c +++ b/addressbook/backends/google/e-book-backend-google.c @@ -1021,12 +1021,8 @@ request_authorization (EBookBackend *backend, GError **error) { EBookBackendGooglePrivate *priv; - ESourceRegistry *registry; - ESource *source; priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend); - source = e_backend_get_source (E_BACKEND (backend)); - registry = e_book_backend_get_registry (backend); /* Make sure we have the GDataService configured * before requesting authorization. */ @@ -1073,8 +1069,9 @@ request_authorization (EBookBackend *backend, #endif /* Otherwise it's up to us to obtain a login secret. */ - return e_source_registry_authenticate_sync ( - registry, source, E_SOURCE_AUTHENTICATOR (backend), + return e_backend_authenticate_sync ( + E_BACKEND (backend), + E_SOURCE_AUTHENTICATOR (backend), cancellable, error); } diff --git a/addressbook/backends/ldap/e-book-backend-ldap.c b/addressbook/backends/ldap/e-book-backend-ldap.c index d3d2ab8..dbbfac9 100644 --- a/addressbook/backends/ldap/e-book-backend-ldap.c +++ b/addressbook/backends/ldap/e-book-backend-ldap.c @@ -5152,7 +5152,6 @@ e_book_backend_ldap_open (EBookBackend *backend, ESourceAuthentication *auth_extension; ESourceLDAP *ldap_extension; ESourceOffline *offline_extension; - ESourceRegistry *registry; ESource *source; const gchar *extension_name; const gchar *cache_dir; @@ -5168,8 +5167,6 @@ e_book_backend_ldap_open (EBookBackend *backend, source = e_backend_get_source (E_BACKEND (backend)); cache_dir = e_book_backend_get_cache_dir (backend); - registry = e_book_backend_get_registry (backend); - extension_name = E_SOURCE_EXTENSION_AUTHENTICATION; auth_extension = e_source_get_extension (source, extension_name); @@ -5251,8 +5248,8 @@ e_book_backend_ldap_open (EBookBackend *backend, } if (auth_required && error == NULL) - e_source_registry_authenticate_sync ( - registry, source, + e_backend_authenticate_sync ( + E_BACKEND (backend), E_SOURCE_AUTHENTICATOR (backend), cancellable, &error); diff --git a/addressbook/backends/webdav/e-book-backend-webdav.c b/addressbook/backends/webdav/e-book-backend-webdav.c index 7c104a5..91a1591 100644 --- a/addressbook/backends/webdav/e-book-backend-webdav.c +++ b/addressbook/backends/webdav/e-book-backend-webdav.c @@ -1246,7 +1246,6 @@ e_book_backend_webdav_open (EBookBackend *backend, ESourceAuthentication *auth_extension; ESourceOffline *offline_extension; ESourceWebdav *webdav_extension; - ESourceRegistry *registry; ESource *source; const gchar *extension_name; const gchar *cache_dir; @@ -1258,8 +1257,6 @@ e_book_backend_webdav_open (EBookBackend *backend, /* will try fetch ctag for the first time, if it fails then sets this to FALSE */ priv->supports_getctag = TRUE; - registry = e_book_backend_get_registry (backend); - source = e_backend_get_source (E_BACKEND (backend)); cache_dir = e_book_backend_get_cache_dir (backend); @@ -1319,8 +1316,8 @@ e_book_backend_webdav_open (EBookBackend *backend, e_book_backend_notify_readonly (backend, FALSE); if (e_source_authentication_required (auth_extension)) - e_source_registry_authenticate_sync ( - registry, source, + e_backend_authenticate_sync ( + E_BACKEND (backend), E_SOURCE_AUTHENTICATOR (backend), cancellable, &error); diff --git a/calendar/backends/caldav/e-cal-backend-caldav.c b/calendar/backends/caldav/e-cal-backend-caldav.c index 5f365b2..0219b34 100644 --- a/calendar/backends/caldav/e-cal-backend-caldav.c +++ b/calendar/backends/caldav/e-cal-backend-caldav.c @@ -1172,24 +1172,20 @@ caldav_authenticate (ECalBackendCalDAV *cbdav, GCancellable *cancellable, GError **error) { - ESource *source; - ESourceRegistry *registry; - gboolean res; - - source = e_backend_get_source (E_BACKEND (cbdav)); - registry = e_cal_backend_get_registry (E_CAL_BACKEND (cbdav)); + gboolean success; if (ref_cbdav) g_object_ref (cbdav); - res = e_source_registry_authenticate_sync ( - registry, source, E_SOURCE_AUTHENTICATOR (cbdav), + success = e_backend_authenticate_sync ( + E_BACKEND (cbdav), + E_SOURCE_AUTHENTICATOR (cbdav), cancellable, error); if (ref_cbdav) caldav_unref_in_thread (cbdav); - return res; + return success; } /* Returns whether calendar changed on the server. This works only when server diff --git a/calendar/backends/http/e-cal-backend-http.c b/calendar/backends/http/e-cal-backend-http.c index 83cbfc2..4337cb1 100644 --- a/calendar/backends/http/e-cal-backend-http.c +++ b/calendar/backends/http/e-cal-backend-http.c @@ -738,8 +738,6 @@ begin_retrieval_cb (GIOSchedulerJob *job, GCancellable *cancellable, ECalBackendHttp *backend) { - ESource *source; - ESourceRegistry *registry; const gchar *uri; GError *error = NULL; @@ -755,16 +753,13 @@ begin_retrieval_cb (GIOSchedulerJob *job, backend->priv->is_loading = TRUE; - source = e_backend_get_source (E_BACKEND (backend)); - registry = e_cal_backend_get_registry (E_CAL_BACKEND (backend)); - uri = cal_backend_http_ensure_uri (backend); cal_backend_http_load (backend, cancellable, uri, &error); if (g_error_matches (error, SOUP_HTTP_ERROR, SOUP_STATUS_UNAUTHORIZED)) { g_clear_error (&error); - e_source_registry_authenticate_sync ( - registry, source, + e_backend_authenticate_sync ( + E_BACKEND (backend), E_SOURCE_AUTHENTICATOR (backend), cancellable, &error); } -- 2.7.4