From 9a149f3ab61a08a5943d57045fad59cd894ba7a5 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 2 May 2011 15:34:56 -0400 Subject: EMConfigTargetAccount: Add original_account member. Rename the existing 'account' member to 'modified_account' and add an 'original_account' member so plugins have direct access to both. Mostly of benefit to the imap-features plugin. --- mail/em-account-editor.c | 13 +++++++++---- mail/em-config.c | 29 ++++++++++++++++++++++------- mail/em-config.h | 8 ++++---- 3 files changed, 35 insertions(+), 15 deletions(-) (limited to 'mail') diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c index a0083ecee4..e720fb81ed 100644 --- a/mail/em-account-editor.c +++ b/mail/em-account-editor.c @@ -3885,10 +3885,13 @@ set_provider_defaults_on_url (EMAccountEditor *emae, CamelProvider *provider, Ca } static void -em_account_editor_construct (EMAccountEditor *emae, EMAccountEditorType type, const gchar *id) +em_account_editor_construct (EMAccountEditor *emae, + EMAccountEditorType type, + const gchar *id) { EMAccountEditorPrivate *priv = emae->priv; - EAccount *account; + EAccount *original_account; + EAccount *modified_account; gint i, index; GSList *l; GList *prov; @@ -3976,8 +3979,10 @@ em_account_editor_construct (EMAccountEditor *emae, EMAccountEditorType type, co e_config_add_page_check ((EConfig *)ec, NULL, emae_check_complete, emae); - account = em_account_editor_get_modified_account (emae); - target = em_config_target_new_account (ec, account); + original_account = em_account_editor_get_original_account (emae); + modified_account = em_account_editor_get_modified_account (emae); + target = em_config_target_new_account ( + ec, original_account, modified_account); e_config_set_target ((EConfig *)ec, (EConfigTarget *)target); } diff --git a/mail/em-config.c b/mail/em-config.c index bc1c0e50d0..e6ed1d5b3b 100644 --- a/mail/em-config.c +++ b/mail/em-config.c @@ -83,7 +83,7 @@ em_config_set_target (EConfig *ep, EMConfig *config = (EMConfig *) ep; config->priv->account_changed_id = g_signal_connect ( - s->account, "changed", + s->modified_account, "changed", G_CALLBACK(emp_account_changed), ep); break; } } @@ -106,7 +106,7 @@ em_config_target_free (EConfig *ep, if (config->priv->account_changed_id > 0) { g_signal_handler_disconnect ( - s->account, + s->modified_account, config->priv->account_changed_id); config->priv->account_changed_id = 0; } @@ -130,7 +130,10 @@ em_config_target_free (EConfig *ep, case EM_CONFIG_TARGET_ACCOUNT: { EMConfigTargetAccount *s = (EMConfigTargetAccount *)t; - g_object_unref (s->account); + if (s->original_account != NULL) + g_object_unref (s->original_account); + if (s->modified_account != NULL) + g_object_unref (s->modified_account); break; } } @@ -204,12 +207,24 @@ em_config_target_new_prefs (EMConfig *emp, } EMConfigTargetAccount * -em_config_target_new_account (EMConfig *emp, struct _EAccount *account) +em_config_target_new_account (EMConfig *emp, + EAccount *original_account, + EAccount *modified_account) { - EMConfigTargetAccount *t = e_config_target_new (&emp->config, EM_CONFIG_TARGET_ACCOUNT, sizeof (*t)); + EMConfigTargetAccount *t; - t->account = account; - g_object_ref (account); + t = e_config_target_new ( + &emp->config, EM_CONFIG_TARGET_ACCOUNT, sizeof (*t)); + + if (original_account != NULL) + t->original_account = g_object_ref (original_account); + else + t->original_account = NULL; + + if (modified_account != NULL) + t->modified_account = g_object_ref (modified_account); + else + t->modified_account = NULL; return t; } diff --git a/mail/em-config.h b/mail/em-config.h index bd39a4702c..f52dcf8714 100644 --- a/mail/em-config.h +++ b/mail/em-config.h @@ -64,9 +64,8 @@ struct _EMConfigTargetPrefs { struct _EMConfigTargetAccount { EConfigTarget target; - EAccount *account; - /* Need also: working account, not just real account, so changes can be propagated around - And some mechamism for controlling the gui if we're running inside an assistant, e.g. enabling 'next' */ + EAccount *original_account; + EAccount *modified_account; }; typedef struct _EConfigItem EMConfigItem; @@ -92,7 +91,8 @@ EMConfigTargetPrefs * GConfClient *gconf); EMConfigTargetAccount * em_config_target_new_account (EMConfig *emp, - EAccount *account); + EAccount *original_account, + EAccount *modified_account); G_END_DECLS -- cgit v1.2.3