aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2012-06-23 08:08:39 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-06-23 08:12:11 +0800
commite9b5561fd07e799b9c292eb2792f9a8b334204cf (patch)
treeb93a5fe60d67f4ca145b612245620cd853e683f5
parent97792841a09d2617fb297940d887fd7233b1eb2d (diff)
downloadgsoc2013-evolution-e9b5561fd07e799b9c292eb2792f9a8b334204cf.tar
gsoc2013-evolution-e9b5561fd07e799b9c292eb2792f9a8b334204cf.tar.gz
gsoc2013-evolution-e9b5561fd07e799b9c292eb2792f9a8b334204cf.tar.bz2
gsoc2013-evolution-e9b5561fd07e799b9c292eb2792f9a8b334204cf.tar.lz
gsoc2013-evolution-e9b5561fd07e799b9c292eb2792f9a8b334204cf.tar.xz
gsoc2013-evolution-e9b5561fd07e799b9c292eb2792f9a8b334204cf.tar.zst
gsoc2013-evolution-e9b5561fd07e799b9c292eb2792f9a8b334204cf.zip
EMailConfigSummaryPage: Remove "account-name" property.
It's redundant. Just set the display name on one of the ESources.
-rw-r--r--mail/e-mail-config-assistant.c5
-rw-r--r--mail/e-mail-config-summary-page.c73
-rw-r--r--mail/e-mail-config-summary-page.h5
-rw-r--r--modules/mail-config/e-mail-config-google-summary.c14
-rw-r--r--modules/mail-config/e-mail-config-yahoo-summary.c14
5 files changed, 20 insertions, 91 deletions
diff --git a/mail/e-mail-config-assistant.c b/mail/e-mail-config-assistant.c
index e6fa0e3074..680463c76d 100644
--- a/mail/e-mail-config-assistant.c
+++ b/mail/e-mail-config-assistant.c
@@ -249,11 +249,10 @@ mail_config_assistant_autoconfigure_cb (GObject *source_object,
e_mail_config_service_page_auto_configure (
priv->sending_page, autoconfig);
- /* Also set the initial account name to the email address
+ /* Also set the initial display name to the email address
* given so the user can just click past the Summary page. */
email_address = e_mail_autoconfig_get_email_address (autoconfig);
- e_mail_config_summary_page_set_account_name (
- priv->summary_page, email_address);
+ e_source_set_display_name (priv->identity_source, email_address);
/* XXX Can't find a better way to learn the page number of
* the summary page. Oh my god this API is horrible. */
diff --git a/mail/e-mail-config-summary-page.c b/mail/e-mail-config-summary-page.c
index 110b007bd9..b8b96bf390 100644
--- a/mail/e-mail-config-summary-page.c
+++ b/mail/e-mail-config-summary-page.c
@@ -29,7 +29,6 @@
((obj), E_TYPE_MAIL_CONFIG_SUMMARY_PAGE, EMailConfigSummaryPagePrivate))
struct _EMailConfigSummaryPagePrivate {
- gchar *account_name;
ESource *account_source;
ESource *identity_source;
ESource *transport_source;
@@ -56,7 +55,6 @@ struct _EMailConfigSummaryPagePrivate {
enum {
PROP_0,
- PROP_ACCOUNT_NAME,
PROP_ACCOUNT_BACKEND,
PROP_ACCOUNT_SOURCE,
PROP_IDENTITY_SOURCE,
@@ -164,12 +162,6 @@ mail_config_summary_page_set_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
- case PROP_ACCOUNT_NAME:
- e_mail_config_summary_page_set_account_name (
- E_MAIL_CONFIG_SUMMARY_PAGE (object),
- g_value_get_string (value));
- return;
-
case PROP_ACCOUNT_BACKEND:
e_mail_config_summary_page_set_account_backend (
E_MAIL_CONFIG_SUMMARY_PAGE (object),
@@ -199,13 +191,6 @@ mail_config_summary_page_get_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
- case PROP_ACCOUNT_NAME:
- g_value_set_string (
- value,
- e_mail_config_summary_page_get_account_name (
- E_MAIL_CONFIG_SUMMARY_PAGE (object)));
- return;
-
case PROP_ACCOUNT_BACKEND:
g_value_set_object (
value,
@@ -294,20 +279,6 @@ mail_config_summary_page_dispose (GObject *object)
}
static void
-mail_config_summary_page_finalize (GObject *object)
-{
- EMailConfigSummaryPagePrivate *priv;
-
- priv = E_MAIL_CONFIG_SUMMARY_PAGE_GET_PRIVATE (object);
-
- g_free (priv->account_name);
-
- /* Chain up to parent's finalize() method. */
- G_OBJECT_CLASS (e_mail_config_summary_page_parent_class)->
- finalize (object);
-}
-
-static void
mail_config_summary_page_constructed (GObject *object)
{
EMailConfigSummaryPage *page;
@@ -388,12 +359,6 @@ mail_config_summary_page_constructed (GObject *object)
widget, "changed",
G_CALLBACK (e_mail_config_page_changed), page);
- g_object_bind_property (
- widget, "text",
- page, "account-name",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
-
/*** Details ***/
widget = gtk_grid_new ();
@@ -744,24 +709,12 @@ e_mail_config_summary_page_class_init (EMailConfigSummaryPageClass *class)
object_class->set_property = mail_config_summary_page_set_property;
object_class->get_property = mail_config_summary_page_get_property;
object_class->dispose = mail_config_summary_page_dispose;
- object_class->finalize = mail_config_summary_page_finalize;
object_class->constructed = mail_config_summary_page_constructed;
class->refresh = mail_config_summary_page_refresh;
g_object_class_install_property (
object_class,
- PROP_ACCOUNT_NAME,
- g_param_spec_string (
- "account-name",
- "Account Name",
- "Display name for the mail account",
- NULL,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (
- object_class,
PROP_ACCOUNT_BACKEND,
g_param_spec_object (
"account-backend",
@@ -854,32 +807,6 @@ e_mail_config_summary_page_refresh (EMailConfigSummaryPage *page)
g_signal_emit (page, signals[REFRESH], 0);
}
-const gchar *
-e_mail_config_summary_page_get_account_name (EMailConfigSummaryPage *page)
-{
- g_return_val_if_fail (E_IS_MAIL_CONFIG_SUMMARY_PAGE (page), NULL);
-
- return page->priv->account_name;
-}
-
-void
-e_mail_config_summary_page_set_account_name (EMailConfigSummaryPage *page,
- const gchar *account_name)
-{
- g_return_if_fail (E_IS_MAIL_CONFIG_SUMMARY_PAGE (page));
-
- if (account_name == NULL)
- account_name = "";
-
- if (g_strcmp0 (page->priv->account_name, account_name) == 0)
- return;
-
- g_free (page->priv->account_name);
- page->priv->account_name = g_strdup (account_name);
-
- g_object_notify (G_OBJECT (page), "account-name");
-}
-
EMailConfigServiceBackend *
e_mail_config_summary_page_get_account_backend (EMailConfigSummaryPage *page)
{
diff --git a/mail/e-mail-config-summary-page.h b/mail/e-mail-config-summary-page.h
index 2bfc03af8e..6e43fdd9f0 100644
--- a/mail/e-mail-config-summary-page.h
+++ b/mail/e-mail-config-summary-page.h
@@ -69,11 +69,6 @@ EMailConfigPage *
e_mail_config_summary_page_new (void);
void e_mail_config_summary_page_refresh
(EMailConfigSummaryPage *page);
-const gchar * e_mail_config_summary_page_get_account_name
- (EMailConfigSummaryPage *page);
-void e_mail_config_summary_page_set_account_name
- (EMailConfigSummaryPage *page,
- const gchar *account_name);
EMailConfigServiceBackend *
e_mail_config_summary_page_get_account_backend
(EMailConfigSummaryPage *page);
diff --git a/modules/mail-config/e-mail-config-google-summary.c b/modules/mail-config/e-mail-config-google-summary.c
index e4e383d3f8..ca0580e8a6 100644
--- a/modules/mail-config/e-mail-config-google-summary.c
+++ b/modules/mail-config/e-mail-config-google-summary.c
@@ -119,6 +119,7 @@ mail_config_google_summary_commit_changes_cb (EMailConfigSummaryPage *page,
GList *head, *link;
const gchar *address;
const gchar *parent_uid;
+ const gchar *display_name;
const gchar *extension_name;
gboolean calendar_active;
gboolean contacts_active;
@@ -137,13 +138,17 @@ mail_config_google_summary_commit_changes_cb (EMailConfigSummaryPage *page,
if (!calendar_active && !contacts_active)
return;
- /* The collection identity is the user's email address. */
source = e_mail_config_summary_page_get_identity_source (page);
+ display_name = e_source_get_display_name (source);
+
+ /* The collection identity is the user's email address. */
extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY;
identity_extension = e_source_get_extension (source, extension_name);
address = e_source_mail_identity_get_address (identity_extension);
source = extension->priv->collection_source;
+ e_source_set_display_name (source, display_name);
+
extension_name = E_SOURCE_EXTENSION_COLLECTION;
collection_extension = e_source_get_extension (source, extension_name);
e_source_collection_set_identity (collection_extension, address);
@@ -279,10 +284,9 @@ mail_config_google_summary_constructed (GObject *object)
extension_name = E_SOURCE_EXTENSION_COLLECTION;
collection_extension = e_source_get_extension (source, extension_name);
- g_object_bind_property (
- page, "account-name",
- source, "display-name",
- G_BINDING_SYNC_CREATE);
+ /* Can't bind the collection's display name here because
+ * the Summary Page has no sources yet. Set the display
+ * name while committing instead. */
g_object_bind_property (
extension->priv->calendar_toggle, "active",
diff --git a/modules/mail-config/e-mail-config-yahoo-summary.c b/modules/mail-config/e-mail-config-yahoo-summary.c
index 204424ca1a..2153f9cadf 100644
--- a/modules/mail-config/e-mail-config-yahoo-summary.c
+++ b/modules/mail-config/e-mail-config-yahoo-summary.c
@@ -118,6 +118,7 @@ mail_config_yahoo_summary_commit_changes_cb (EMailConfigSummaryPage *page,
GList *head, *link;
const gchar *address;
const gchar *parent_uid;
+ const gchar *display_name;
const gchar *extension_name;
gboolean calendar_active;
@@ -132,13 +133,17 @@ mail_config_yahoo_summary_commit_changes_cb (EMailConfigSummaryPage *page,
if (!calendar_active)
return;
- /* The collection identity is the user's email address. */
source = e_mail_config_summary_page_get_identity_source (page);
+ display_name = e_source_get_display_name (source);
+
+ /* The collection identity is the user's email address. */
extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY;
identity_extension = e_source_get_extension (source, extension_name);
address = e_source_mail_identity_get_address (identity_extension);
source = extension->priv->collection_source;
+ e_source_set_display_name (source, display_name);
+
extension_name = E_SOURCE_EXTENSION_COLLECTION;
collection_extension = e_source_get_extension (source, extension_name);
e_source_collection_set_identity (collection_extension, address);
@@ -260,10 +265,9 @@ mail_config_yahoo_summary_constructed (GObject *object)
extension_name = E_SOURCE_EXTENSION_COLLECTION;
collection_extension = e_source_get_extension (source, extension_name);
- g_object_bind_property (
- page, "account-name",
- source, "display-name",
- G_BINDING_SYNC_CREATE);
+ /* Can't bind the collection's display name here because
+ * the Summary Page has no sources yet. Set the display
+ * name while committing instead. */
g_object_bind_property (
extension->priv->calendar_toggle, "active",