[evolution-data-server] Unable to add additional Google calendar



commit c4a79e30b2e2c99df5709644485ed3c6491cfd93
Author: Milan Crha <mcrha redhat com>
Date:   Mon Feb 6 11:10:57 2017 +0100

    Unable to add additional Google calendar
    
    There was no credentials prompt when using Google authentication (OAuth2),
    only an error about secret not found had been shown. This fixes it and
    lets the user to enter Google credentials when not found in the keyring.
    
    Reported downstream as:
    https://bugzilla.redhat.com/show_bug.cgi?id=1418915

 .../e-source-credentials-provider-impl-google.c    |    8 +++++++-
 src/libedataserverui/e-webdav-discover-widget.c    |    1 +
 2 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/libedataserver/e-source-credentials-provider-impl-google.c 
b/src/libedataserver/e-source-credentials-provider-impl-google.c
index 7b16032..b17efa1 100644
--- a/src/libedataserver/e-source-credentials-provider-impl-google.c
+++ b/src/libedataserver/e-source-credentials-provider-impl-google.c
@@ -396,10 +396,16 @@ e_source_credentials_google_refresh_token_sync (ESource *source,
 
        secret = e_named_parameters_get (credentials, E_SOURCE_CREDENTIAL_GOOGLE_SECRET);
        if (!secret) {
-               g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Failed to get Google secret 
from credentials"));
+               if (error && !*error)
+                       g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Failed to get Google 
secret from credentials"));
+
                return FALSE;
        }
 
+       if (error && g_error_matches (*error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) {
+               g_clear_error (error);
+       }
+
        if (!e_source_credentials_google_util_decode_from_secret (secret, E_GOOGLE_SECRET_REFRESH_TOKEN, 
&refresh_token, NULL) ||
            !refresh_token || !*refresh_token) {
                g_free (refresh_token);
diff --git a/src/libedataserverui/e-webdav-discover-widget.c b/src/libedataserverui/e-webdav-discover-widget.c
index d1ad68c..944a583 100644
--- a/src/libedataserverui/e-webdav-discover-widget.c
+++ b/src/libedataserverui/e-webdav-discover-widget.c
@@ -721,6 +721,7 @@ e_webdav_discover_content_refresh_done_cb (GObject *source_object,
                        rd = NULL;
                } else if (g_cancellable_is_cancelled (rd->cancellable) ||
                    (!g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED) &&
+                   !g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND) &&
                    !g_error_matches (local_error, SOUP_HTTP_ERROR, SOUP_STATUS_UNAUTHORIZED) &&
                    !g_error_matches (local_error, SOUP_HTTP_ERROR, SOUP_STATUS_FORBIDDEN))) {
                        g_simple_async_result_take_error (rd->simple, local_error);


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