[evolution-ews] Prefill compile-time OAuth2 settings, to be shown in the GUI



commit 7b37324fdd8da76938d7ae241b5b63bd0246031f
Author: Milan Crha <mcrha redhat com>
Date:   Thu Nov 19 18:28:15 2020 +0100

    Prefill compile-time OAuth2 settings, to be shown in the GUI
    
    The compile-time settings had been used in the background, but they
    were not visible in the GUI, only as part of the tooltip on respective
    widgets and it might not be clear that the values can be left (visually)
    empty. The only downside is that the values will be stored in the memory
    and in the files, but it might not be a big deal.

 src/EWS/common/camel-ews-settings.c                     | 8 ++++----
 src/EWS/evolution/e-mail-config-ews-backend.c           | 6 ++++--
 src/Microsoft365/common/camel-m365-settings.c           | 8 ++++----
 src/Microsoft365/evolution/e-mail-config-m365-backend.c | 6 ++++--
 4 files changed, 16 insertions(+), 12 deletions(-)
---
diff --git a/src/EWS/common/camel-ews-settings.c b/src/EWS/common/camel-ews-settings.c
index 61b4a22a..bab1a896 100644
--- a/src/EWS/common/camel-ews-settings.c
+++ b/src/EWS/common/camel-ews-settings.c
@@ -751,7 +751,7 @@ camel_ews_settings_class_init (CamelEwsSettingsClass *class)
                        "oauth2-tenant",
                        "OAuth2 Tenant",
                        "OAuth2 Tenant to use, only if override-oauth2 is TRUE, otherwise the compile-time 
value is used",
-                       NULL,
+                       OFFICE365_TENANT,
                        G_PARAM_READWRITE |
                        G_PARAM_CONSTRUCT |
                        G_PARAM_STATIC_STRINGS));
@@ -763,7 +763,7 @@ camel_ews_settings_class_init (CamelEwsSettingsClass *class)
                        "oauth2-client-id",
                        "OAuth2 Client ID",
                        "OAuth2 Client-ID to use, only if override-oauth2 is TRUE, otherwise the compile-time 
value is used",
-                       NULL,
+                       OFFICE365_CLIENT_ID,
                        G_PARAM_READWRITE |
                        G_PARAM_CONSTRUCT |
                        G_PARAM_STATIC_STRINGS));
@@ -775,7 +775,7 @@ camel_ews_settings_class_init (CamelEwsSettingsClass *class)
                        "oauth2-redirect-uri",
                        "OAuth2 Redirect URI",
                        "OAuth2 Redirect URI to use, only if override-oauth2 is TRUE, otherwise the 
compile-time value is used",
-                       NULL,
+                       OFFICE365_REDIRECT_URI,
                        G_PARAM_READWRITE |
                        G_PARAM_CONSTRUCT |
                        G_PARAM_STATIC_STRINGS));
@@ -799,7 +799,7 @@ camel_ews_settings_class_init (CamelEwsSettingsClass *class)
                        "oauth2-endpoint-host",
                        "OAuth2 Endpoint Host",
                        "OAuth2 endpoint host to use, only if override-oauth2 is TRUE, otherwise the 
compile-time value is used",
-                       NULL,
+                       OFFICE365_ENDPOINT_HOST,
                        G_PARAM_READWRITE |
                        G_PARAM_CONSTRUCT |
                        G_PARAM_STATIC_STRINGS));
diff --git a/src/EWS/evolution/e-mail-config-ews-backend.c b/src/EWS/evolution/e-mail-config-ews-backend.c
index 929e4785..be5380c9 100644
--- a/src/EWS/evolution/e-mail-config-ews-backend.c
+++ b/src/EWS/evolution/e-mail-config-ews-backend.c
@@ -495,8 +495,10 @@ mail_config_ews_backend_insert_widgets (EMailConfigServiceBackend *backend,
        camel_ews_settings_lock (ews_settings);
 
        gtk_expander_set_expanded (GTK_EXPANDER (expander),
-               e_util_strcmp0 (camel_ews_settings_get_oauth2_endpoint_host (ews_settings), NULL) != 0 ||
-               e_util_strcmp0 (camel_ews_settings_get_oauth2_redirect_uri (ews_settings), NULL) != 0 ||
+               (e_util_strcmp0 (camel_ews_settings_get_oauth2_endpoint_host (ews_settings), NULL) != 0 &&
+                e_util_strcmp0 (camel_ews_settings_get_oauth2_endpoint_host (ews_settings), 
OFFICE365_ENDPOINT_HOST) != 0) ||
+               (e_util_strcmp0 (camel_ews_settings_get_oauth2_redirect_uri (ews_settings), NULL) != 0 &&
+                e_util_strcmp0 (camel_ews_settings_get_oauth2_redirect_uri (ews_settings), 
OFFICE365_REDIRECT_URI) != 0) ||
                e_util_strcmp0 (camel_ews_settings_get_oauth2_resource_uri (ews_settings), NULL) != 0);
 
        camel_ews_settings_unlock (ews_settings);
diff --git a/src/Microsoft365/common/camel-m365-settings.c b/src/Microsoft365/common/camel-m365-settings.c
index 039b1fab..7d1f0e98 100644
--- a/src/Microsoft365/common/camel-m365-settings.c
+++ b/src/Microsoft365/common/camel-m365-settings.c
@@ -470,7 +470,7 @@ camel_m365_settings_class_init (CamelM365SettingsClass *class)
                        "oauth2-tenant",
                        "OAuth2 Tenant",
                        "OAuth2 Tenant to use, only if override-oauth2 is TRUE, otherwise the compile-time 
value is used",
-                       NULL,
+                       MICROSOFT365_TENANT,
                        G_PARAM_READWRITE |
                        G_PARAM_CONSTRUCT |
                        G_PARAM_STATIC_STRINGS));
@@ -482,7 +482,7 @@ camel_m365_settings_class_init (CamelM365SettingsClass *class)
                        "oauth2-client-id",
                        "OAuth2 Client ID",
                        "OAuth2 Client-ID to use, only if override-oauth2 is TRUE, otherwise the compile-time 
value is used",
-                       NULL,
+                       MICROSOFT365_CLIENT_ID,
                        G_PARAM_READWRITE |
                        G_PARAM_CONSTRUCT |
                        G_PARAM_STATIC_STRINGS));
@@ -494,7 +494,7 @@ camel_m365_settings_class_init (CamelM365SettingsClass *class)
                        "oauth2-redirect-uri",
                        "OAuth2 Redirect URI",
                        "OAuth2 Redirect URI to use, only if override-oauth2 is TRUE, otherwise the 
compile-time value is used",
-                       NULL,
+                       MICROSOFT365_REDIRECT_URI,
                        G_PARAM_READWRITE |
                        G_PARAM_CONSTRUCT |
                        G_PARAM_STATIC_STRINGS));
@@ -506,7 +506,7 @@ camel_m365_settings_class_init (CamelM365SettingsClass *class)
                        "oauth2-endpoint-host",
                        "OAuth2 Endpoint Host",
                        "OAuth2 endpoint host to use, only if override-oauth2 is TRUE, otherwise the 
compile-time value is used",
-                       NULL,
+                       MICROSOFT365_ENDPOINT_HOST,
                        G_PARAM_READWRITE |
                        G_PARAM_CONSTRUCT |
                        G_PARAM_STATIC_STRINGS));
diff --git a/src/Microsoft365/evolution/e-mail-config-m365-backend.c 
b/src/Microsoft365/evolution/e-mail-config-m365-backend.c
index 36b22f36..996c9f58 100644
--- a/src/Microsoft365/evolution/e-mail-config-m365-backend.c
+++ b/src/Microsoft365/evolution/e-mail-config-m365-backend.c
@@ -360,8 +360,10 @@ mail_config_m365_backend_insert_widgets (EMailConfigServiceBackend *backend,
        camel_m365_settings_lock (m365_settings);
 
        gtk_expander_set_expanded (GTK_EXPANDER (expander),
-               e_util_strcmp0 (camel_m365_settings_get_oauth2_endpoint_host (m365_settings), NULL) != 0 ||
-               e_util_strcmp0 (camel_m365_settings_get_oauth2_redirect_uri (m365_settings), NULL) != 0);
+               (e_util_strcmp0 (camel_m365_settings_get_oauth2_endpoint_host (m365_settings), NULL) != 0 &&
+                e_util_strcmp0 (camel_m365_settings_get_oauth2_endpoint_host (m365_settings), 
MICROSOFT365_ENDPOINT_HOST) != 0) ||
+               (e_util_strcmp0 (camel_m365_settings_get_oauth2_redirect_uri (m365_settings), NULL) != 0 &&
+                e_util_strcmp0 (camel_m365_settings_get_oauth2_redirect_uri (m365_settings), 
MICROSOFT365_REDIRECT_URI) != 0));
 
        camel_m365_settings_unlock (m365_settings);
 


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