diff options
author | Milan Crha <mcrha@redhat.com> | 2011-08-16 14:52:13 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2011-08-16 14:52:13 +0800 |
commit | 082f62aaa3958d8748bf1033efa8d90d439049aa (patch) | |
tree | 77d7e6eec7ab7e87905df1989eb73bb0aaa47a25 | |
parent | 6e1e36c0474312058a1479d2f570428c2dc0e806 (diff) | |
download | gsoc2013-evolution-082f62aaa3958d8748bf1033efa8d90d439049aa.tar.gz gsoc2013-evolution-082f62aaa3958d8748bf1033efa8d90d439049aa.tar.zst gsoc2013-evolution-082f62aaa3958d8748bf1033efa8d90d439049aa.zip |
Bug #656620 - Account editor doesn't update on settings change
-rw-r--r-- | mail/em-account-editor.c | 6 | ||||
-rw-r--r-- | mail/em-config.c | 38 | ||||
-rw-r--r-- | mail/em-config.h | 4 |
3 files changed, 43 insertions, 5 deletions
diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c index 3b1c16770b..52f930d739 100644 --- a/mail/em-account-editor.c +++ b/mail/em-account-editor.c @@ -1588,11 +1588,7 @@ emae_setup_settings (EMAccountEditorService *service) config = E_CONFIG (service->emae->priv->config); target = (EMConfigTargetAccount *) config->target; - if (target->settings != NULL) - g_object_unref (target->settings); - target->settings = service->emae->priv->source.settings; - if (target->settings != NULL) - g_object_ref (target->settings); + em_config_target_new_account_update_settings (config, target, service->emae->priv->source.settings); } static void diff --git a/mail/em-config.c b/mail/em-config.c index fbde5d5430..3f649bacb3 100644 --- a/mail/em-config.c +++ b/mail/em-config.c @@ -85,6 +85,8 @@ em_config_set_target (EConfig *ep, config->priv->account_changed_id = g_signal_connect ( s->modified_account, "changed", G_CALLBACK (emp_account_changed), ep); + + em_config_target_new_account_update_settings (ep, s, s->settings); break; } } } @@ -110,6 +112,8 @@ em_config_target_free (EConfig *ep, config->priv->account_changed_id); config->priv->account_changed_id = 0; } + + em_config_target_new_account_update_settings (ep, s, NULL); break; } } } @@ -233,3 +237,37 @@ em_config_target_new_account (EMConfig *emp, return t; } + +void +em_config_target_new_account_update_settings (EConfig *ep, EMConfigTargetAccount *target, CamelSettings *settings) +{ + g_return_if_fail (ep != NULL); + g_return_if_fail (target != NULL); + + if (settings) + g_object_ref (settings); + + if (target->settings != NULL) { + g_signal_handlers_disconnect_by_func (target->settings, G_CALLBACK (emp_account_changed), ep); + g_object_unref (target->settings); + } + + target->settings = settings; + + if (target->settings != NULL) { + GParamSpec **params; + guint n_params = 0; + + params = camel_settings_class_list_settings (CAMEL_SETTINGS_GET_CLASS (target->settings), &n_params); + if (params) { + guint ii; + gchar *sig_name; + + for (ii = 0; ii < n_params; ii++) { + sig_name = g_strconcat ("notify::", params[ii]->name, NULL); + g_signal_connect (target->settings, sig_name, G_CALLBACK (emp_account_changed), ep); + g_free (sig_name); + } + } + } +} diff --git a/mail/em-config.h b/mail/em-config.h index 0291f2446a..dcd5194ea5 100644 --- a/mail/em-config.h +++ b/mail/em-config.h @@ -93,6 +93,10 @@ EMConfigTargetAccount * EAccount *original_account, EAccount *modified_account, CamelSettings *settings); +void em_config_target_new_account_update_settings + (EConfig *ep, + EMConfigTargetAccount *target, + CamelSettings *settings); G_END_DECLS |