From 8d7a5a1b878015001997a817dda092fd62d54f6e Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 1 Jun 2013 15:21:53 -0400 Subject: Add e_composer_header_table_ref_source(). Convenience function that works like e_source_registry_ref_source(), but spares the caller from digging out the ESourceRegistry from the header table. --- composer/e-msg-composer.c | 62 ++++++----------------------------------------- 1 file changed, 7 insertions(+), 55 deletions(-) (limited to 'composer/e-msg-composer.c') diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index efb29e0b2e..d247180734 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -532,8 +532,6 @@ build_message_headers (EMsgComposer *composer, { EComposerHeaderTable *table; EComposerHeader *header; - EClientCache *client_cache; - ESourceRegistry *registry; ESource *source; const gchar *subject; const gchar *reply_to; @@ -544,11 +542,8 @@ build_message_headers (EMsgComposer *composer, table = e_msg_composer_get_header_table (composer); - client_cache = e_composer_header_table_ref_client_cache (table); - registry = e_client_cache_ref_registry (client_cache); - uid = e_composer_header_table_get_identity_uid (table); - source = e_source_registry_ref_source (registry, uid); + source = e_composer_header_table_ref_source (table, uid); /* Subject: */ subject = e_composer_header_table_get_subject (table); @@ -660,9 +655,6 @@ build_message_headers (EMsgComposer *composer, } g_list_free (list); } - - g_object_unref (client_cache); - g_object_unref (registry); } static CamelCipherHash @@ -1086,8 +1078,6 @@ composer_build_message (EMsgComposer *composer, EComposerHeaderTable *table; CamelDataWrapper *html; ESourceMailIdentity *mi; - EClientCache *client_cache; - ESourceRegistry *registry; const gchar *extension_name; const gchar *iconv_charset = NULL; const gchar *identity_uid; @@ -1108,15 +1098,8 @@ composer_build_message (EMsgComposer *composer, view = e_msg_composer_get_attachment_view (composer); store = e_attachment_view_get_store (view); - client_cache = e_composer_header_table_ref_client_cache (table); - registry = e_client_cache_ref_registry (client_cache); - identity_uid = e_composer_header_table_get_identity_uid (table); - source = e_source_registry_ref_source (registry, identity_uid); - - g_clear_object (&client_cache); - g_clear_object (®istry); - + source = e_composer_header_table_ref_source (table, identity_uid); g_return_if_fail (source != NULL); /* Do all the non-blocking work here, and defer @@ -1581,8 +1564,6 @@ msg_composer_mail_identity_changed_cb (EMsgComposer *composer) { EMsgComposerPrivate *p = composer->priv; EMailSignatureComboBox *combo_box; - EClientCache *client_cache; - ESourceRegistry *registry; ESourceMailComposition *mc; ESourceOpenPGP *pgp; ESourceSMIME *smime; @@ -1603,12 +1584,7 @@ msg_composer_mail_identity_changed_cb (EMsgComposer *composer) if (uid == NULL) return; - client_cache = e_composer_header_table_ref_client_cache (table); - registry = e_client_cache_ref_registry (client_cache); - source = e_source_registry_ref_source (registry, uid); - g_clear_object (&client_cache); - g_clear_object (®istry); - + source = e_composer_header_table_ref_source (table, uid); g_return_if_fail (source != NULL); extension_name = E_SOURCE_EXTENSION_MAIL_COMPOSITION; @@ -3098,8 +3074,6 @@ e_msg_composer_new_with_message (EShell *shell, EMsgComposer *composer; EMsgComposerPrivate *priv; EComposerHeaderTable *table; - EClientCache *client_cache; - ESourceRegistry *registry; ESource *source = NULL; GtkToggleAction *action; struct _camel_header_raw *xev; @@ -3131,9 +3105,6 @@ e_msg_composer_new_with_message (EShell *shell, postto = NULL; } - client_cache = e_composer_header_table_ref_client_cache (table); - registry = e_client_cache_ref_registry (client_cache); - /* Restore the mail identity preference. */ identity_uid = (gchar *) camel_medium_get_header ( CAMEL_MEDIUM (message), "X-Evolution-Identity"); @@ -3144,12 +3115,10 @@ e_msg_composer_new_with_message (EShell *shell, } if (identity_uid != NULL) { identity_uid = g_strstrip (g_strdup (identity_uid)); - source = e_source_registry_ref_source (registry, identity_uid); + source = e_composer_header_table_ref_source ( + table, identity_uid); } - g_clear_object (&client_cache); - g_clear_object (®istry); - if (postto == NULL) { auto_cc = g_hash_table_new_full ( (GHashFunc) camel_strcase_hash, @@ -4228,8 +4197,6 @@ e_msg_composer_set_body (EMsgComposer *composer, EMsgComposerPrivate *priv = composer->priv; EComposerHeaderTable *table; EWebViewGtkHTML *web_view; - EClientCache *client_cache; - ESourceRegistry *registry; ESource *source; const gchar *identity_uid; gchar *buff; @@ -4238,14 +4205,8 @@ e_msg_composer_set_body (EMsgComposer *composer, table = e_msg_composer_get_header_table (composer); - client_cache = e_composer_header_table_ref_client_cache (table); - registry = e_client_cache_ref_registry (client_cache); - identity_uid = e_composer_header_table_get_identity_uid (table); - source = e_source_registry_ref_source (registry, identity_uid); - - g_clear_object (&client_cache); - g_clear_object (®istry); + source = e_composer_header_table_ref_source (table, identity_uid); buff = g_markup_printf_escaped ( "%s", @@ -4789,8 +4750,6 @@ e_msg_composer_get_from (EMsgComposer *composer) CamelInternetAddress *inet_address = NULL; ESourceMailIdentity *mail_identity; EComposerHeaderTable *table; - EClientCache *client_cache; - ESourceRegistry *registry; ESource *source; const gchar *extension_name; const gchar *uid; @@ -4801,15 +4760,8 @@ e_msg_composer_get_from (EMsgComposer *composer) table = e_msg_composer_get_header_table (composer); - client_cache = e_composer_header_table_ref_client_cache (table); - registry = e_client_cache_ref_registry (client_cache); - uid = e_composer_header_table_get_identity_uid (table); - source = e_source_registry_ref_source (registry, uid); - - g_clear_object (&client_cache); - g_clear_object (®istry); - + source = e_composer_header_table_ref_source (table, uid); g_return_val_if_fail (source != NULL, NULL); extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY; -- cgit v1.2.3