[evolution/gnome-3-38] I#1094 - CollectionAccountWizard: Eventually prefill account name from server name
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/gnome-3-38] I#1094 - CollectionAccountWizard: Eventually prefill account name from server name
- Date: Mon, 14 Sep 2020 16:30:26 +0000 (UTC)
commit c17aef29506050389c4e3866b8c986b3b97a069d
Author: Milan Crha <mcrha redhat com>
Date: Mon Sep 14 18:28:30 2020 +0200
I#1094 - CollectionAccountWizard: Eventually prefill account name from server name
Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1094
src/e-util/e-collection-account-wizard.c | 41 ++++++++++++++++++++++++++++++--
1 file changed, 39 insertions(+), 2 deletions(-)
---
diff --git a/src/e-util/e-collection-account-wizard.c b/src/e-util/e-collection-account-wizard.c
index 87398e8698..110d3b2bff 100644
--- a/src/e-util/e-collection-account-wizard.c
+++ b/src/e-util/e-collection-account-wizard.c
@@ -2550,8 +2550,38 @@ e_collection_account_wizard_next (ECollectionAccountWizard *wizard)
text = gtk_entry_get_text (GTK_ENTRY (wizard->priv->display_name_entry));
if (!text || !*text) {
- gtk_entry_set_text (GTK_ENTRY (wizard->priv->display_name_entry),
- gtk_entry_get_text (GTK_ENTRY (wizard->priv->email_entry)));
+ gchar *tmp = NULL;
+
+ text = gtk_entry_get_text (GTK_ENTRY (wizard->priv->email_entry));
+
+ if (!text || !*text) {
+ text = gtk_entry_get_text (GTK_ENTRY (wizard->priv->servers_entry));
+
+ if (text && *text) {
+ gchar *ptr;
+
+ if (g_ascii_strncasecmp (text, "http://", 7) == 0)
+ text += 7;
+ else if (g_ascii_strncasecmp (text, "https://", 8) == 0)
+ text += 8;
+
+ /* get the first entered server name */
+ ptr = strchr (text, ';');
+ tmp = ptr ? g_strndup (text, ptr - text) : g_strdup (text);
+
+ /* eventually skip the path */
+ ptr = strchr (tmp, '/');
+ if (ptr)
+ *ptr = '\0';
+
+ text = tmp;
+ }
+ }
+
+ if (text && *text)
+ gtk_entry_set_text (GTK_ENTRY (wizard->priv->display_name_entry), text);
+
+ g_free (tmp);
}
gtk_notebook_set_current_page (GTK_NOTEBOOK (wizard), 2);
@@ -2564,6 +2594,10 @@ e_collection_account_wizard_next (ECollectionAccountWizard *wizard)
break;
}
+ /* To update sensitivity of the "Next"/"Finish" button */
+ if (changed)
+ g_object_notify (G_OBJECT (wizard), "can-run");
+
return changed;
}
@@ -2593,6 +2627,9 @@ e_collection_account_wizard_prev (ECollectionAccountWizard *wizard)
gtk_notebook_set_current_page (GTK_NOTEBOOK (wizard), current_page - 1);
+ /* To update sensitivity of the "Next"/"Finish" button */
+ g_object_notify (G_OBJECT (wizard), "can-run");
+
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]