[evolution] CollectionAccountWizard: Show provided error message when password is required
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] CollectionAccountWizard: Show provided error message when password is required
- Date: Tue, 15 Sep 2020 10:11:02 +0000 (UTC)
commit 949363264f933f0cfb90c94012875396ec51343d
Author: Milan Crha <mcrha redhat com>
Date: Tue Sep 15 12:09:24 2020 +0200
CollectionAccountWizard: Show provided error message when password is required
That way the password request can contain more detailed information from
the lookup worker, if it can/wants to provide any such.
src/e-util/e-collection-account-wizard.c | 22 +++++++++++++++++-----
src/modules/config-lookup/e-webdav-config-lookup.c | 6 +++---
2 files changed, 20 insertions(+), 8 deletions(-)
---
diff --git a/src/e-util/e-collection-account-wizard.c b/src/e-util/e-collection-account-wizard.c
index 110d3b2bff..977b19defe 100644
--- a/src/e-util/e-collection-account-wizard.c
+++ b/src/e-util/e-collection-account-wizard.c
@@ -500,8 +500,16 @@ collection_account_wizard_worker_finished_cb (EConfigLookup *config_lookup,
link = g_markup_printf_escaped ("<a href=\"evo:enter-password\">%s</a>", _("Enter password"));
- /* Translators: The %s is replaced with a clickable text "Enter password", thus it'll be
"Requires password to continue. Enter password." at the end. */
- markup = g_strdup_printf (_("Requires password to continue. %s."), link);
+ if (error->message && *error->message) {
+ gchar *escaped;
+
+ escaped = g_markup_escape_text (error->message, -1);
+ markup = g_strconcat (escaped, " ", link, NULL);
+ g_free (escaped);
+ } else {
+ /* Translators: The %s is replaced with a clickable text "Enter password", thus it'll
be "Requires password to continue. Enter password." at the end. */
+ markup = g_strdup_printf (_("Requires password to continue. %s."), link);
+ }
gtk_label_set_markup (GTK_LABEL (wd->running_label), markup);
@@ -510,17 +518,20 @@ collection_account_wizard_worker_finished_cb (EConfigLookup *config_lookup,
} else if (g_error_matches (error, E_CONFIG_LOOKUP_WORKER_ERROR,
E_CONFIG_LOOKUP_WORKER_ERROR_CERTIFICATE) &&
restart_params && e_named_parameters_exists (restart_params,
E_CONFIG_LOOKUP_PARAM_CERTIFICATE_PEM) &&
e_named_parameters_exists (restart_params, E_CONFIG_LOOKUP_PARAM_CERTIFICATE_HOST)) {
- gchar *markup, *link;
+ gchar *markup, *link, *escaped = NULL;
wd->certificate_error = g_strdup (error->message);
link = g_markup_printf_escaped ("<a href=\"evo:view-certificate\">%s</a>", _("View
certificate"));
- markup = g_strconcat (error->message ? error->message : "",
- error->message ? "\n" : "", link, NULL);
+ if (error->message && *error->message)
+ escaped = g_markup_escape_text (error->message, -1);
+
+ markup = g_strconcat (escaped ? escaped : "", escaped ? "\n" : "", link, NULL);
gtk_label_set_markup (GTK_LABEL (wd->running_label), markup);
+ g_free (escaped);
g_free (markup);
g_free (link);
} else if (error) {
@@ -1865,6 +1876,7 @@ collection_account_wizard_constructed (GObject *object)
"valign", GTK_ALIGN_CENTER,
"visible", TRUE,
"ellipsize", PANGO_ELLIPSIZE_END,
+ "selectable", TRUE,
NULL);
wd->running_label = label;
diff --git a/src/modules/config-lookup/e-webdav-config-lookup.c
b/src/modules/config-lookup/e-webdav-config-lookup.c
index e77951dcaf..a4646138c6 100644
--- a/src/modules/config-lookup/e-webdav-config-lookup.c
+++ b/src/modules/config-lookup/e-webdav-config-lookup.c
@@ -158,10 +158,10 @@ webdav_config_lookup_propagate_error (GError **error,
gboolean *out_authentication_failed)
{
if (g_error_matches (local_error, SOUP_HTTP_ERROR, SOUP_STATUS_UNAUTHORIZED)) {
- local_error->domain = E_CONFIG_LOOKUP_WORKER_ERROR;
- local_error->code = E_CONFIG_LOOKUP_WORKER_ERROR_REQUIRES_PASSWORD;
+ g_set_error_literal (error, E_CONFIG_LOOKUP_WORKER_ERROR,
E_CONFIG_LOOKUP_WORKER_ERROR_REQUIRES_PASSWORD,
+ _("Requires password to continue."));
- g_propagate_error (error, local_error);
+ g_clear_error (&local_error);
if (out_authentication_failed)
*out_authentication_failed = TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]