diff options
-rw-r--r-- | calendar/gui/itip-utils.c | 7 | ||||
-rw-r--r-- | composer/e-composer-header-table.c | 114 | ||||
-rw-r--r-- | composer/e-composer-header-table.h | 5 | ||||
-rw-r--r-- | composer/e-composer-private.c | 6 | ||||
-rw-r--r-- | composer/e-msg-composer.c | 49 | ||||
-rw-r--r-- | doc/reference/evolution-mail-composer/evolution-mail-composer-sections.txt | 2 | ||||
-rw-r--r-- | mail/em-composer-utils.c | 34 |
7 files changed, 150 insertions, 67 deletions
diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c index 0ae5b45e5e..beb62b9189 100644 --- a/calendar/gui/itip-utils.c +++ b/calendar/gui/itip-utils.c @@ -1630,10 +1630,12 @@ setup_from (ECalComponentItipMethod method, ECalClient *cal_client, EComposerHeaderTable *table) { + EClientCache *client_cache; ESourceRegistry *registry; ESource *source = NULL; - registry = e_composer_header_table_get_registry (table); + client_cache = e_composer_header_table_ref_client_cache (table); + registry = e_client_cache_ref_registry (client_cache); /* always use organizer's email when user is an organizer */ if (itip_organizer_is_user (registry, comp, cal_client)) { @@ -1663,6 +1665,9 @@ setup_from (ECalComponentItipMethod method, g_object_unref (source); } + + g_object_unref (client_cache); + g_object_unref (registry); } gboolean diff --git a/composer/e-composer-header-table.c b/composer/e-composer-header-table.c index 35ac6c9903..77106609c4 100644 --- a/composer/e-composer-header-table.c +++ b/composer/e-composer-header-table.c @@ -52,18 +52,18 @@ struct _EComposerHeaderTablePrivate { GtkWidget *signature_label; GtkWidget *signature_combo_box; ENameSelector *name_selector; - ESourceRegistry *registry; + EClientCache *client_cache; EShell *shell; }; enum { PROP_0, + PROP_CLIENT_CACHE, PROP_DESTINATIONS_BCC, PROP_DESTINATIONS_CC, PROP_DESTINATIONS_TO, PROP_IDENTITY_UID, PROP_POST_TO, - PROP_REGISTRY, PROP_REPLY_TO, PROP_SHELL, PROP_SIGNATURE_COMBO_BOX, @@ -399,13 +399,16 @@ composer_header_table_setup_post_headers (EComposerHeaderTable *table) static gboolean composer_header_table_show_post_headers (EComposerHeaderTable *table) { + EClientCache *client_cache; ESourceRegistry *registry; GList *list, *link; const gchar *extension_name; const gchar *target_uid; gboolean show_post_headers = FALSE; - registry = e_composer_header_table_get_registry (table); + client_cache = e_composer_header_table_ref_client_cache (table); + registry = e_client_cache_ref_registry (client_cache); + target_uid = e_composer_header_table_get_identity_uid (table); extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT; @@ -444,6 +447,9 @@ composer_header_table_show_post_headers (EComposerHeaderTable *table) g_list_free_full (list, (GDestroyNotify) g_object_unref); + g_object_unref (client_cache); + g_object_unref (registry); + return show_post_headers; } @@ -452,6 +458,7 @@ composer_header_table_from_changed_cb (EComposerHeaderTable *table) { ESource *source = NULL; ESource *mail_account = NULL; + EClientCache *client_cache; ESourceRegistry *registry; EComposerHeader *header; EComposerHeaderType type; @@ -466,9 +473,10 @@ composer_header_table_from_changed_cb (EComposerHeaderTable *table) /* Keep "Post-To" and "Reply-To" synchronized with "From" */ - registry = e_composer_header_table_get_registry (table); - uid = e_composer_header_table_get_identity_uid (table); + 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); if (uid != NULL) source = e_source_registry_ref_source (registry, uid); @@ -535,16 +543,19 @@ composer_header_table_from_changed_cb (EComposerHeaderTable *table) composer_header_table_setup_post_headers (table); else composer_header_table_setup_mail_headers (table); + + g_object_unref (client_cache); + g_object_unref (registry); } static void -composer_header_table_set_registry (EComposerHeaderTable *table, - ESourceRegistry *registry) +composer_header_table_set_client_cache (EComposerHeaderTable *table, + EClientCache *client_cache) { - g_return_if_fail (E_IS_SOURCE_REGISTRY (registry)); - g_return_if_fail (table->priv->registry == NULL); + g_return_if_fail (E_IS_CLIENT_CACHE (client_cache)); + g_return_if_fail (table->priv->client_cache == NULL); - table->priv->registry = g_object_ref (registry); + table->priv->client_cache = g_object_ref (client_cache); } static void @@ -567,6 +578,12 @@ composer_header_table_set_property (GObject *object, GList *list; switch (property_id) { + case PROP_CLIENT_CACHE: + composer_header_table_set_client_cache ( + E_COMPOSER_HEADER_TABLE (object), + g_value_get_object (value)); + return; + case PROP_DESTINATIONS_BCC: destinations = g_value_dup_destinations (value); e_composer_header_table_set_destinations_bcc ( @@ -605,12 +622,6 @@ composer_header_table_set_property (GObject *object, g_list_free (list); return; - case PROP_REGISTRY: - composer_header_table_set_registry ( - E_COMPOSER_HEADER_TABLE (object), - g_value_get_object (value)); - return; - case PROP_REPLY_TO: e_composer_header_table_set_reply_to ( E_COMPOSER_HEADER_TABLE (object), @@ -649,6 +660,13 @@ composer_header_table_get_property (GObject *object, GList *list; switch (property_id) { + case PROP_CLIENT_CACHE: + g_value_take_object ( + value, + e_composer_header_table_ref_client_cache ( + E_COMPOSER_HEADER_TABLE (object))); + return; + case PROP_DESTINATIONS_BCC: destinations = e_composer_header_table_get_destinations_bcc ( @@ -688,13 +706,6 @@ composer_header_table_get_property (GObject *object, g_list_free (list); return; - case PROP_REGISTRY: - g_value_set_object ( - value, - e_composer_header_table_get_registry ( - E_COMPOSER_HEADER_TABLE (object))); - return; - case PROP_REPLY_TO: g_value_set_string ( value, @@ -760,9 +771,9 @@ composer_header_table_dispose (GObject *object) priv->name_selector = NULL; } - if (priv->registry != NULL) { - g_object_unref (priv->registry); - priv->registry = NULL; + if (priv->client_cache != NULL) { + g_object_unref (priv->client_cache); + priv->client_cache = NULL; } if (priv->shell != NULL) { @@ -783,7 +794,6 @@ composer_header_table_constructed (GObject *object) ESourceRegistry *registry; EComposerHeader *header; GtkWidget *widget; - EShell *shell; guint ii; gint row_padding; @@ -792,9 +802,9 @@ composer_header_table_constructed (GObject *object) constructed (object); table = E_COMPOSER_HEADER_TABLE (object); - shell = e_composer_header_table_get_shell (table); - client_cache = e_shell_get_client_cache (shell); - registry = e_composer_header_table_get_registry (table); + + client_cache = e_composer_header_table_ref_client_cache (table); + registry = e_client_cache_ref_registry (client_cache); name_selector = e_name_selector_new (client_cache); table->priv->name_selector = name_selector; @@ -891,6 +901,9 @@ composer_header_table_constructed (GObject *object) /* Initialize the headers. */ composer_header_table_from_changed_cb (table); + + g_object_unref (client_cache); + g_object_unref (registry); } static void @@ -906,6 +919,23 @@ e_composer_header_table_class_init (EComposerHeaderTableClass *class) object_class->dispose = composer_header_table_dispose; object_class->constructed = composer_header_table_constructed; + /** + * EComposerHeaderTable:client-cache: + * + * Cache of shared #EClient instances. + **/ + g_object_class_install_property ( + object_class, + PROP_CLIENT_CACHE, + g_param_spec_object ( + "client-cache", + "Client Cache", + "Cache of shared EClient instances", + E_TYPE_CLIENT_CACHE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS)); + g_object_class_install_property ( object_class, PROP_DESTINATIONS_BCC, @@ -963,18 +993,6 @@ e_composer_header_table_class_init (EComposerHeaderTableClass *class) g_object_class_install_property ( object_class, - PROP_REGISTRY, - g_param_spec_object ( - "registry", - NULL, - NULL, - E_TYPE_SOURCE_REGISTRY, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property ( - object_class, PROP_REPLY_TO, g_param_spec_string ( "reply-to", @@ -1062,14 +1080,14 @@ e_composer_header_table_init (EComposerHeaderTable *table) GtkWidget * e_composer_header_table_new (EShell *shell, - ESourceRegistry *registry) + EClientCache *client_cache) { g_return_val_if_fail (E_IS_SHELL (shell), NULL); - g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL); + g_return_val_if_fail (E_IS_CLIENT_CACHE (client_cache), NULL); return g_object_new ( E_TYPE_COMPOSER_HEADER_TABLE, - "shell", shell, "registry", registry, NULL); + "shell", shell, "client-cache", client_cache, NULL); } EShell * @@ -1080,12 +1098,12 @@ e_composer_header_table_get_shell (EComposerHeaderTable *table) return table->priv->shell; } -ESourceRegistry * -e_composer_header_table_get_registry (EComposerHeaderTable *table) +EClientCache * +e_composer_header_table_ref_client_cache (EComposerHeaderTable *table) { g_return_val_if_fail (E_IS_COMPOSER_HEADER_TABLE (table), NULL); - return table->priv->registry; + return g_object_ref (table->priv->client_cache); } EComposerHeader * diff --git a/composer/e-composer-header-table.h b/composer/e-composer-header-table.h index f459aaeae8..5ccc77e6a1 100644 --- a/composer/e-composer-header-table.h +++ b/composer/e-composer-header-table.h @@ -71,11 +71,10 @@ struct _EComposerHeaderTableClass { GType e_composer_header_table_get_type (void); GtkWidget * e_composer_header_table_new (EShell *shell, - ESourceRegistry *registry); + EClientCache *client_cache); EShell * e_composer_header_table_get_shell (EComposerHeaderTable *table); -ESourceRegistry * - e_composer_header_table_get_registry +EClientCache * e_composer_header_table_ref_client_cache (EComposerHeaderTable *table); EComposerHeader * e_composer_header_table_get_header diff --git a/composer/e-composer-private.c b/composer/e-composer-private.c index 2e44aa1aa9..90ff2037c8 100644 --- a/composer/e-composer-private.c +++ b/composer/e-composer-private.c @@ -141,7 +141,7 @@ e_composer_private_constructed (EMsgComposer *composer) EFocusTracker *focus_tracker; EShell *shell; EWebViewGtkHTML *web_view; - ESourceRegistry *registry; + EClientCache *client_cache; GtkhtmlEditor *editor; GtkUIManager *ui_manager; GtkAction *action; @@ -161,7 +161,7 @@ e_composer_private_constructed (EMsgComposer *composer) settings = g_settings_new ("org.gnome.evolution.mail"); shell = e_msg_composer_get_shell (composer); - registry = e_shell_get_registry (shell); + client_cache = e_shell_get_client_cache (shell); web_view = e_msg_composer_get_web_view (composer); /* Each composer window gets its own window group. */ @@ -245,7 +245,7 @@ e_composer_private_constructed (EMsgComposer *composer) /* Construct the header table. */ - widget = e_composer_header_table_new (shell, registry); + widget = e_composer_header_table_new (shell, client_cache); gtk_container_set_border_width (GTK_CONTAINER (widget), 6); gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); gtk_box_reorder_child (GTK_BOX (container), widget, 2); diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 0a3a3223f7..efb29e0b2e 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -532,6 +532,7 @@ build_message_headers (EMsgComposer *composer, { EComposerHeaderTable *table; EComposerHeader *header; + EClientCache *client_cache; ESourceRegistry *registry; ESource *source; const gchar *subject; @@ -543,7 +544,9 @@ build_message_headers (EMsgComposer *composer, table = e_msg_composer_get_header_table (composer); - registry = e_composer_header_table_get_registry (table); + 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); @@ -657,6 +660,9 @@ build_message_headers (EMsgComposer *composer, } g_list_free (list); } + + g_object_unref (client_cache); + g_object_unref (registry); } static CamelCipherHash @@ -1080,6 +1086,7 @@ 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; @@ -1101,9 +1108,15 @@ composer_build_message (EMsgComposer *composer, view = e_msg_composer_get_attachment_view (composer); store = e_attachment_view_get_store (view); - registry = e_composer_header_table_get_registry (table); + 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); + g_return_if_fail (source != NULL); /* Do all the non-blocking work here, and defer @@ -1568,6 +1581,7 @@ msg_composer_mail_identity_changed_cb (EMsgComposer *composer) { EMsgComposerPrivate *p = composer->priv; EMailSignatureComboBox *combo_box; + EClientCache *client_cache; ESourceRegistry *registry; ESourceMailComposition *mc; ESourceOpenPGP *pgp; @@ -1583,14 +1597,18 @@ msg_composer_mail_identity_changed_cb (EMsgComposer *composer) const gchar *uid; table = e_msg_composer_get_header_table (composer); - registry = e_composer_header_table_get_registry (table); uid = e_composer_header_table_get_identity_uid (table); /* Silently return if no identity is selected. */ 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); + g_return_if_fail (source != NULL); extension_name = E_SOURCE_EXTENSION_MAIL_COMPOSITION; @@ -3080,6 +3098,7 @@ e_msg_composer_new_with_message (EShell *shell, EMsgComposer *composer; EMsgComposerPrivate *priv; EComposerHeaderTable *table; + EClientCache *client_cache; ESourceRegistry *registry; ESource *source = NULL; GtkToggleAction *action; @@ -3104,7 +3123,6 @@ e_msg_composer_new_with_message (EShell *shell, composer = e_msg_composer_new (shell); priv = E_MSG_COMPOSER_GET_PRIVATE (composer); table = e_msg_composer_get_header_table (composer); - registry = e_composer_header_table_get_registry (table); if (postto) { e_composer_header_table_set_post_to_list (table, postto); @@ -3113,6 +3131,9 @@ 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"); @@ -3126,6 +3147,9 @@ e_msg_composer_new_with_message (EShell *shell, source = e_source_registry_ref_source (registry, 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, @@ -4204,6 +4228,7 @@ 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; @@ -4212,11 +4237,16 @@ e_msg_composer_set_body (EMsgComposer *composer, g_return_if_fail (E_IS_MSG_COMPOSER (composer)); table = e_msg_composer_get_header_table (composer); - registry = e_composer_header_table_get_registry (table); + + 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); + buff = g_markup_printf_escaped ( "<b>%s</b>", _("The composer contains a non-text " @@ -4759,6 +4789,7 @@ 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; @@ -4770,9 +4801,15 @@ e_msg_composer_get_from (EMsgComposer *composer) table = e_msg_composer_get_header_table (composer); - registry = e_composer_header_table_get_registry (table); + 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); + g_return_val_if_fail (source != NULL, NULL); extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY; diff --git a/doc/reference/evolution-mail-composer/evolution-mail-composer-sections.txt b/doc/reference/evolution-mail-composer/evolution-mail-composer-sections.txt index 24090de34d..c1f933715e 100644 --- a/doc/reference/evolution-mail-composer/evolution-mail-composer-sections.txt +++ b/doc/reference/evolution-mail-composer/evolution-mail-composer-sections.txt @@ -41,7 +41,7 @@ e_composer_from_header_get_type EComposerHeaderTable e_composer_header_table_new e_composer_header_table_get_shell -e_composer_header_table_get_registry +e_composer_header_table_ref_client_cache EComposerHeaderType e_composer_header_table_get_header e_composer_header_table_get_signature_combo_box diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index a8815f6f54..0927d6fa90 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -366,13 +366,17 @@ composer_presend_check_identity (EMsgComposer *composer, EMailSession *session) { EComposerHeaderTable *table; + EClientCache *client_cache; ESourceRegistry *registry; ESource *source; const gchar *uid; gboolean success = TRUE; table = e_msg_composer_get_header_table (composer); - registry = e_composer_header_table_get_registry (table); + + 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_return_val_if_fail (source != NULL, FALSE); @@ -384,6 +388,8 @@ composer_presend_check_identity (EMsgComposer *composer, success = FALSE; } + g_object_unref (client_cache); + g_object_unref (registry); g_object_unref (source); return success; @@ -837,6 +843,7 @@ em_utils_composer_save_to_drafts_cb (EMsgComposer *composer, { AsyncContext *context; EComposerHeaderTable *table; + EClientCache *client_cache; ESourceRegistry *registry; ESource *source; const gchar *local_drafts_folder_uri; @@ -851,10 +858,15 @@ em_utils_composer_save_to_drafts_cb (EMsgComposer *composer, table = e_msg_composer_get_header_table (composer); - registry = e_composer_header_table_get_registry (table); + 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); + /* Get the selected identity's preferred Drafts folder. */ if (source != NULL) { ESourceMailComposition *extension; @@ -999,6 +1011,7 @@ create_new_composer (EShell *shell, CamelFolder *folder) { EMsgComposer *composer; + EClientCache *client_cache; ESourceRegistry *registry; EComposerHeaderTable *table; ESource *source = NULL; @@ -1007,7 +1020,9 @@ create_new_composer (EShell *shell, composer = e_msg_composer_new (shell); table = e_msg_composer_get_header_table (composer); - registry = e_composer_header_table_get_registry (table); + + client_cache = e_composer_header_table_ref_client_cache (table); + registry = e_client_cache_ref_registry (client_cache); if (folder != NULL) { CamelStore *store; @@ -1036,6 +1051,9 @@ create_new_composer (EShell *shell, g_free (identity); + g_object_unref (client_cache); + g_object_unref (registry); + return composer; } @@ -1080,8 +1098,9 @@ em_utils_compose_new_message_with_mailto (EShell *shell, CamelFolder *folder) { EMsgComposer *composer; - ESourceRegistry *registry; EComposerHeaderTable *table; + EClientCache *client_cache; + ESourceRegistry *registry; g_return_val_if_fail (E_IS_SHELL (shell), NULL); @@ -1094,7 +1113,9 @@ em_utils_compose_new_message_with_mailto (EShell *shell, composer = e_msg_composer_new (shell); table = e_msg_composer_get_header_table (composer); - registry = e_composer_header_table_get_registry (table); + + client_cache = e_composer_header_table_ref_client_cache (table); + registry = e_client_cache_ref_registry (client_cache); composer_set_no_change (composer); @@ -1117,6 +1138,9 @@ em_utils_compose_new_message_with_mailto (EShell *shell, } } + g_object_unref (client_cache); + g_object_unref (registry); + return composer; } |