From 039c29c112179ad92233f0a85b7332ad2f2dd373 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 7 Nov 2012 15:17:03 +0100 Subject: Bug #686620 - Add an option to skip New Account autodiscovery --- mail/e-mail-config-assistant.c | 23 ++++++++++++ mail/e-mail-config-identity-page.c | 77 +++++++++++++++++++++++++++++++++++++- mail/e-mail-config-identity-page.h | 7 ++++ 3 files changed, 106 insertions(+), 1 deletion(-) (limited to 'mail') diff --git a/mail/e-mail-config-assistant.c b/mail/e-mail-config-assistant.c index 407d076f80..515be98106 100644 --- a/mail/e-mail-config-assistant.c +++ b/mail/e-mail-config-assistant.c @@ -46,6 +46,7 @@ struct _EMailConfigAssistantPrivate { EMailConfigServicePage *receiving_page; EMailConfigServicePage *sending_page; EMailConfigSummaryPage *summary_page; + EMailConfigPage *identity_page; EMailConfigPage *lookup_page; GHashTable *visited_pages; gboolean auto_configure_done; @@ -451,6 +452,11 @@ mail_config_assistant_dispose (GObject *object) priv->lookup_page = NULL; } + if (priv->identity_page != NULL) { + g_object_unref (priv->identity_page); + priv->identity_page = NULL; + } + g_ptr_array_set_size (priv->account_sources, 0); g_ptr_array_set_size (priv->transport_sources, 0); @@ -488,6 +494,7 @@ mail_config_assistant_constructed (GObject *object) ESourceMailSubmission *mail_submission_extension; EMailSession *session; EMailConfigPage *page; + GtkWidget *autodiscover_check; GList *list, *link; const gchar *extension_name; const gchar *title; @@ -550,7 +557,12 @@ mail_config_assistant_constructed (GObject *object) E_MAIL_CONFIG_IDENTITY_PAGE (page), FALSE); e_mail_config_identity_page_set_show_signatures ( E_MAIL_CONFIG_IDENTITY_PAGE (page), FALSE); + e_mail_config_identity_page_set_show_autodiscover_check ( + E_MAIL_CONFIG_IDENTITY_PAGE (page), TRUE); + autodiscover_check = e_mail_config_identity_page_get_autodiscover_check ( + E_MAIL_CONFIG_IDENTITY_PAGE (page)); e_mail_config_assistant_add_page (assistant, page); + assistant->priv->identity_page = g_object_ref (page); /*** Lookup Page ***/ @@ -558,6 +570,11 @@ mail_config_assistant_constructed (GObject *object) e_mail_config_assistant_add_page (assistant, page); assistant->priv->lookup_page = g_object_ref (page); + g_object_bind_property ( + autodiscover_check, "active", + page, "visible", + G_BINDING_SYNC_CREATE); + /*** Receiving Page ***/ page = e_mail_config_receiving_page_new (registry); @@ -792,6 +809,12 @@ mail_config_assistant_prepare (GtkAssistant *assistant, email_address = e_source_mail_identity_get_address (extension); e_source_set_display_name (source, email_address); } + + if (first_visit && ( + E_IS_MAIL_CONFIG_LOOKUP_PAGE (page) || + E_IS_MAIL_CONFIG_RECEIVING_PAGE (page))) + e_mail_config_identity_page_set_show_autodiscover_check ( + E_MAIL_CONFIG_IDENTITY_PAGE (priv->identity_page), FALSE); } static void diff --git a/mail/e-mail-config-identity-page.c b/mail/e-mail-config-identity-page.c index 40b18f4c36..ce7102d726 100644 --- a/mail/e-mail-config-identity-page.c +++ b/mail/e-mail-config-identity-page.c @@ -38,6 +38,8 @@ struct _EMailConfigIdentityPagePrivate { gboolean show_email_address; gboolean show_instructions; gboolean show_signatures; + gboolean show_autodiscover_check; + GtkWidget *autodiscover_check; /* not referenced */ }; enum { @@ -47,7 +49,8 @@ enum { PROP_SHOW_ACCOUNT_INFO, PROP_SHOW_EMAIL_ADDRESS, PROP_SHOW_INSTRUCTIONS, - PROP_SHOW_SIGNATURES + PROP_SHOW_SIGNATURES, + PROP_SHOW_AUTODISCOVER_CHECK }; /* Forward Declarations */ @@ -151,6 +154,12 @@ mail_config_identity_page_set_property (GObject *object, E_MAIL_CONFIG_IDENTITY_PAGE (object), g_value_get_boolean (value)); return; + + case PROP_SHOW_AUTODISCOVER_CHECK: + e_mail_config_identity_page_set_show_autodiscover_check ( + E_MAIL_CONFIG_IDENTITY_PAGE (object), + g_value_get_boolean (value)); + return; } G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -204,6 +213,13 @@ mail_config_identity_page_get_property (GObject *object, e_mail_config_identity_page_get_show_signatures ( E_MAIL_CONFIG_IDENTITY_PAGE (object))); return; + + case PROP_SHOW_AUTODISCOVER_CHECK: + g_value_set_boolean ( + value, + e_mail_config_identity_page_get_show_autodiscover_check ( + E_MAIL_CONFIG_IDENTITY_PAGE (object))); + return; } G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -261,6 +277,8 @@ mail_config_identity_page_constructed (GObject *object) GTK_ORIENTABLE (page), GTK_ORIENTATION_VERTICAL); gtk_box_set_spacing (GTK_BOX (page), 12); + gtk_widget_set_valign (GTK_WIDGET (page), GTK_ALIGN_FILL); + gtk_widget_set_vexpand (GTK_WIDGET (page), TRUE); /* This keeps all mnemonic labels the same width. */ size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); @@ -537,6 +555,22 @@ mail_config_identity_page_constructed (GObject *object) g_object_unref (size_group); e_extensible_load_extensions (E_EXTENSIBLE (page)); + + widget = gtk_check_button_new_with_mnemonic (_("Try _setup account automatically, based on Email Address")); + g_object_set (G_OBJECT (widget), + "valign", GTK_ALIGN_END, + "vexpand", TRUE, + "active", TRUE, + NULL); + + g_object_bind_property ( + page, "show-autodiscover-check", + widget, "visible", + G_BINDING_SYNC_CREATE); + + page->priv->autodiscover_check = widget; + + gtk_container_add (GTK_CONTAINER (page), widget); } static gboolean @@ -671,6 +705,18 @@ e_mail_config_identity_page_class_init (EMailConfigIdentityPageClass *class) G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property ( + object_class, + PROP_SHOW_AUTODISCOVER_CHECK, + g_param_spec_boolean ( + "show-autodiscover-check", + "Show Autodiscover Check", + "Show check button to allow autodiscover based on Email Address", + FALSE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); } static void @@ -805,3 +851,32 @@ e_mail_config_identity_page_set_show_signatures (EMailConfigIdentityPage *page, g_object_notify (G_OBJECT (page), "show-signatures"); } +void +e_mail_config_identity_page_set_show_autodiscover_check (EMailConfigIdentityPage *page, + gboolean show_autodiscover) +{ + g_return_if_fail (E_IS_MAIL_CONFIG_IDENTITY_PAGE (page)); + + if ((page->priv->show_autodiscover_check ? 1 : 0) == (show_autodiscover ? 1 : 0)) + return; + + page->priv->show_autodiscover_check = show_autodiscover; + + g_object_notify (G_OBJECT (page), "show-autodiscover-check"); +} + +gboolean +e_mail_config_identity_page_get_show_autodiscover_check (EMailConfigIdentityPage *page) +{ + g_return_val_if_fail (E_IS_MAIL_CONFIG_IDENTITY_PAGE (page), FALSE); + + return page->priv->show_autodiscover_check; +} + +GtkWidget * +e_mail_config_identity_page_get_autodiscover_check (EMailConfigIdentityPage *page) +{ + g_return_val_if_fail (E_IS_MAIL_CONFIG_IDENTITY_PAGE (page), NULL); + + return page->priv->autodiscover_check; +} diff --git a/mail/e-mail-config-identity-page.h b/mail/e-mail-config-identity-page.h index 02a3c16e26..df6e91f3dd 100644 --- a/mail/e-mail-config-identity-page.h +++ b/mail/e-mail-config-identity-page.h @@ -90,6 +90,13 @@ gboolean e_mail_config_identity_page_get_show_signatures void e_mail_config_identity_page_set_show_signatures (EMailConfigIdentityPage *page, gboolean show_signatures); +void e_mail_config_identity_page_set_show_autodiscover_check + (EMailConfigIdentityPage *page, + gboolean show_autodiscover); +gboolean e_mail_config_identity_page_get_show_autodiscover_check + (EMailConfigIdentityPage *page); +GtkWidget * e_mail_config_identity_page_get_autodiscover_check + (EMailConfigIdentityPage *page); G_END_DECLS -- cgit