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
This commit is contained in:
Milan Crha
2021-01-15 11:04:26 +01:00
parent b14d9ac54d
commit 117387218c

View File

@ -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);
}