diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2012-10-29 04:58:25 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-10-29 05:18:15 +0800 |
commit | abb81c8b831cc7e5c6513e9b7c79d6a4fa0c5cc6 (patch) | |
tree | 0b50b47c55dac0589edfeb071f5765ebcfdcaa4e /mail | |
parent | 6472883a8bee32d7de03802c65b96d97a7e3f643 (diff) | |
download | gsoc2013-evolution-abb81c8b831cc7e5c6513e9b7c79d6a4fa0c5cc6.tar.gz gsoc2013-evolution-abb81c8b831cc7e5c6513e9b7c79d6a4fa0c5cc6.tar.zst gsoc2013-evolution-abb81c8b831cc7e5c6513e9b7c79d6a4fa0c5cc6.zip |
EMailConfigIdentityPage: Add a "show-email-address" property.
Allows the Email Address field to be hidden.
Diffstat (limited to 'mail')
-rw-r--r-- | mail/e-mail-config-identity-page.c | 70 | ||||
-rw-r--r-- | mail/e-mail-config-identity-page.h | 5 |
2 files changed, 71 insertions, 4 deletions
diff --git a/mail/e-mail-config-identity-page.c b/mail/e-mail-config-identity-page.c index 6bbe701700..81f0c46909 100644 --- a/mail/e-mail-config-identity-page.c +++ b/mail/e-mail-config-identity-page.c @@ -35,6 +35,7 @@ struct _EMailConfigIdentityPagePrivate { ESource *identity_source; ESourceRegistry *registry; gboolean show_account_info; + gboolean show_email_address; gboolean show_instructions; gboolean show_signatures; }; @@ -44,6 +45,7 @@ enum { PROP_IDENTITY_SOURCE, PROP_REGISTRY, PROP_SHOW_ACCOUNT_INFO, + PROP_SHOW_EMAIL_ADDRESS, PROP_SHOW_INSTRUCTIONS, PROP_SHOW_SIGNATURES }; @@ -132,6 +134,12 @@ mail_config_identity_page_set_property (GObject *object, g_value_get_boolean (value)); return; + case PROP_SHOW_EMAIL_ADDRESS: + e_mail_config_identity_page_set_show_email_address ( + E_MAIL_CONFIG_IDENTITY_PAGE (object), + g_value_get_boolean (value)); + return; + case PROP_SHOW_INSTRUCTIONS: e_mail_config_identity_page_set_show_instructions ( E_MAIL_CONFIG_IDENTITY_PAGE (object), @@ -176,6 +184,13 @@ mail_config_identity_page_get_property (GObject *object, E_MAIL_CONFIG_IDENTITY_PAGE (object))); return; + case PROP_SHOW_EMAIL_ADDRESS: + g_value_set_boolean ( + value, + e_mail_config_identity_page_get_show_email_address ( + E_MAIL_CONFIG_IDENTITY_PAGE (object))); + return; + case PROP_SHOW_INSTRUCTIONS: g_value_set_boolean ( value, @@ -377,6 +392,11 @@ mail_config_identity_page_constructed (GObject *object) gtk_grid_attach (GTK_GRID (container), widget, 0, 2, 1, 1); gtk_widget_show (widget); + g_object_bind_property ( + page, "show-email-address", + widget, "visible", + G_BINDING_SYNC_CREATE); + label = GTK_LABEL (widget); widget = gtk_entry_new (); @@ -391,6 +411,11 @@ mail_config_identity_page_constructed (GObject *object) G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); + g_object_bind_property ( + page, "show-email-address", + widget, "visible", + G_BINDING_SYNC_CREATE); + /* This entry affects the "check-complete" result. */ g_signal_connect_swapped ( widget, "changed", @@ -541,11 +566,14 @@ mail_config_identity_page_check_complete (EMailConfigPage *page) if (name == NULL) return FALSE; - if (address == NULL) - return FALSE; + /* Only enforce when the email address is visible. */ + if (e_mail_config_identity_page_get_show_email_address (id_page)) { + if (address == NULL) + return FALSE; - if (!mail_config_identity_page_is_email (address)) - return FALSE; + if (!mail_config_identity_page_is_email (address)) + return FALSE; + } /* A NULL reply_to string is allowed. */ if (reply_to != NULL && !mail_config_identity_page_is_email (reply_to)) @@ -611,6 +639,18 @@ e_mail_config_identity_page_class_init (EMailConfigIdentityPageClass *class) g_object_class_install_property ( object_class, + PROP_SHOW_EMAIL_ADDRESS, + g_param_spec_boolean ( + "show-email-address", + "Show Email Address", + "Show the \"Email Address\" field", + TRUE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property ( + object_class, PROP_SHOW_INSTRUCTIONS, g_param_spec_boolean ( "show-instructions", @@ -701,6 +741,28 @@ e_mail_config_identity_page_set_show_account_info (EMailConfigIdentityPage *page } gboolean +e_mail_config_identity_page_get_show_email_address (EMailConfigIdentityPage *page) +{ + g_return_val_if_fail (E_IS_MAIL_CONFIG_IDENTITY_PAGE (page), FALSE); + + return page->priv->show_email_address; +} + +void +e_mail_config_identity_page_set_show_email_address (EMailConfigIdentityPage *page, + gboolean show_email_address) +{ + g_return_if_fail (E_IS_MAIL_CONFIG_IDENTITY_PAGE (page)); + + if (page->priv->show_email_address == show_email_address) + return; + + page->priv->show_email_address = show_email_address; + + g_object_notify (G_OBJECT (page), "show-email-address"); +} + +gboolean e_mail_config_identity_page_get_show_instructions (EMailConfigIdentityPage *page) { g_return_val_if_fail (E_IS_MAIL_CONFIG_IDENTITY_PAGE (page), FALSE); diff --git a/mail/e-mail-config-identity-page.h b/mail/e-mail-config-identity-page.h index cfc6ea139e..02a3c16e26 100644 --- a/mail/e-mail-config-identity-page.h +++ b/mail/e-mail-config-identity-page.h @@ -75,6 +75,11 @@ gboolean e_mail_config_identity_page_get_show_account_info void e_mail_config_identity_page_set_show_account_info (EMailConfigIdentityPage *page, gboolean show_account_info); +gboolean e_mail_config_identity_page_get_show_email_address + (EMailConfigIdentityPage *page); +void e_mail_config_identity_page_set_show_email_address + (EMailConfigIdentityPage *page, + gboolean show_email_address); gboolean e_mail_config_identity_page_get_show_instructions (EMailConfigIdentityPage *page); void e_mail_config_identity_page_set_show_instructions |