[evolution-data-server] Provide default implementation of EBackend::authenticate_sync()



commit 2c129bd7fb83202dc79a4d660c49002bd88d9aea
Author: Milan Crha <mcrha redhat com>
Date:   Fri Jun 12 12:42:38 2015 +0200

    Provide default implementation of EBackend::authenticate_sync()
    
    This only returns 'success' for any requests to not force each descendant
    define the same function. Some of the descendants, like the GTasks calendar
    backend, doesn't need this method, because it requires OAuth2 token,
    which is received through GOA. Without this a false "failed to open"
    error was shown in the UI, with an "Unknown error" description, because
    it failed on a runtime constraint.

 libebackend/e-backend.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/libebackend/e-backend.c b/libebackend/e-backend.c
index 8b7efcd..ddd3c48 100644
--- a/libebackend/e-backend.c
+++ b/libebackend/e-backend.c
@@ -579,6 +579,21 @@ backend_constructed (GObject *object)
        }
 }
 
+static ESourceAuthenticationResult
+backend_authenticate_sync (EBackend *backend,
+                          const ENamedParameters *credentials,
+                          gchar **out_certificate_pem,
+                          GTlsCertificateFlags *out_certificate_errors,
+                          GCancellable *cancellable,
+                          GError **error)
+{
+       /* The default implementation just reports success, it's for backends
+          which do not use (nor define) authentication routines, because
+          they use different methods to get to the credentials. */
+
+       return E_SOURCE_AUTHENTICATION_ACCEPTED;
+}
+
 static gboolean
 backend_get_destination_address (EBackend *backend,
                                  gchar **host,
@@ -629,6 +644,7 @@ e_backend_class_init (EBackendClass *class)
        object_class->finalize = backend_finalize;
        object_class->constructed = backend_constructed;
 
+       class->authenticate_sync = backend_authenticate_sync;
        class->get_destination_address = backend_get_destination_address;
        class->prepare_shutdown = backend_prepare_shutdown;
 


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