Use e_backend_authenticate_sync() in backends.
authorMatthew Barnes <mbarnes@redhat.com>
Tue, 31 Jul 2012 22:07:02 +0000 (18:07 -0400)
committerMatthew Barnes <mbarnes@redhat.com>
Tue, 31 Jul 2012 22:08:48 +0000 (18:08 -0400)
addressbook/backends/google/e-book-backend-google.c
addressbook/backends/ldap/e-book-backend-ldap.c
addressbook/backends/webdav/e-book-backend-webdav.c
calendar/backends/caldav/e-cal-backend-caldav.c
calendar/backends/http/e-cal-backend-http.c

index 9b0c6b9..1593327 100644 (file)
@@ -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);
 }
 
index d3d2ab8..dbbfac9 100644 (file)
@@ -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);
 
index 7c104a5..91a1591 100644 (file)
@@ -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);
 
index 5f365b2..0219b34 100644 (file)
@@ -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
index 83cbfc2..4337cb1 100644 (file)
@@ -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);
        }