[evolution] EMailConfigAssistant: Prefill user name for the new accounts



commit 117387218c43167f762525e465d1bab09bbc8139
Author: Milan Crha <mcrha redhat com>
Date:   Fri Jan 15 11:04:26 2021 +0100

    EMailConfigAssistant: Prefill user name for the new accounts
    
    Make the 'user' property be prefilled by the currently logged in
    user name, thus it is not empty for newly created accounts.
    
    Partly related to https://gitlab.gnome.org/GNOME/evolution-data-server/-/issues/283

 src/mail/e-mail-config-assistant.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
---
diff --git a/src/mail/e-mail-config-assistant.c b/src/mail/e-mail-config-assistant.c
index 857dcc9ffb..e7e114eb24 100644
--- a/src/mail/e-mail-config-assistant.c
+++ b/src/mail/e-mail-config-assistant.c
@@ -669,6 +669,19 @@ mail_config_assistant_finalize (GObject *object)
                finalize (object);
 }
 
+static void
+mail_config_assistant_prefill_user (ESource *on_source)
+{
+       if (e_source_has_extension (on_source, E_SOURCE_EXTENSION_AUTHENTICATION)) {
+               ESourceAuthentication *auth_extension;
+
+               auth_extension = e_source_get_extension (on_source, E_SOURCE_EXTENSION_AUTHENTICATION);
+
+               if (!e_source_authentication_get_user (auth_extension))
+                       e_source_authentication_set_user (auth_extension, g_get_user_name ());
+       }
+}
+
 static void
 mail_config_assistant_constructed (GObject *object)
 {
@@ -837,6 +850,8 @@ mail_config_assistant_constructed (GObject *object)
                backend = e_mail_config_service_page_add_scratch_source (
                        assistant->priv->receiving_page, scratch_source, NULL);
 
+               mail_config_assistant_prefill_user (scratch_source);
+
                g_object_unref (scratch_source);
 
                page = e_mail_config_provider_page_new (backend);
@@ -914,6 +929,8 @@ mail_config_assistant_constructed (GObject *object)
                e_mail_config_service_page_add_scratch_source (
                        assistant->priv->sending_page, scratch_source, NULL);
 
+               mail_config_assistant_prefill_user (scratch_source);
+
                g_object_unref (scratch_source);
        }
 


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