From 80fffd093013bd250c98e1a05591de1a0b029f5a Mon Sep 17 00:00:00 2001 From: Larry Ewing Date: Mon, 29 Oct 2001 23:30:25 +0000 Subject: add GList to hold the current images. 2001-10-29 Larry Ewing * e-msg-composer.h: add GList to hold the current images. * listener.c (resolve_image_url): keep track of the images that the editor is currently uses in current_images as well as storing the images in the hash. * e-msg-composer.c (clear_current_images): clear the list of images actually in the message. (add_inlined_images): use the current image list rather than the hash tables. (build_message): clear the current image list when appropriate. (init): initialize current_images. svn path=/trunk/; revision=14379 --- composer/e-msg-composer.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) (limited to 'composer/e-msg-composer.c') diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 6ec023bb43..50c4e608c8 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -245,6 +245,13 @@ clear_inline_images (gpointer key, gpointer value, gpointer user_data) return TRUE; } +static void +clear_current_images (EMsgComposer *composer) +{ + g_list_free (composer->current_images); + composer->current_images = NULL; +} + static gboolean clear_url (gpointer key, gpointer value, gpointer user_data) { @@ -260,16 +267,17 @@ e_msg_composer_clear_inlined_table (EMsgComposer *composer) g_hash_table_foreach_remove (composer->inline_images_by_url, clear_url, NULL); } -static void -add_inlined_image (gpointer key, gpointer part, gpointer multipart) -{ - camel_multipart_add_part (multipart, part); -} - static void add_inlined_images (EMsgComposer *composer, CamelMultipart *multipart) { - g_hash_table_foreach (composer->inline_images, add_inlined_image, multipart); + GList *d = composer->current_images; + + while (d) { + CamelMimePart *part = d->data; + + camel_multipart_add_part (multipart, part); + d = d->next; + } } /* This functions builds a CamelMimeMessage for the message that the user has @@ -325,7 +333,9 @@ build_message (EMsgComposer *composer) header_content_type_unref (type); if (composer->send_html) { - data = get_text (composer->persist_stream_interface, "text/html"); + clear_current_images (composer); + + data = get_text (composer->persist_stream_interface, "text/html"); if (!data) { /* The component has probably died */ camel_object_unref (CAMEL_OBJECT (new)); @@ -361,7 +371,7 @@ build_message (EMsgComposer *composer) * multipart/related containing the * multipart/alternative and the images. */ - if (g_hash_table_size (composer->inline_images)) { + if (composer->current_images) { CamelMultipart *html_with_images; html_with_images = camel_multipart_new (); @@ -377,6 +387,8 @@ build_message (EMsgComposer *composer) camel_object_unref (CAMEL_OBJECT (part)); add_inlined_images (composer, html_with_images); + clear_current_images (composer); + current = CAMEL_DATA_WRAPPER (html_with_images); } else current = CAMEL_DATA_WRAPPER (body); @@ -2136,7 +2148,8 @@ init (EMsgComposer *composer) composer->editor_engine = CORBA_OBJECT_NIL; composer->inline_images = g_hash_table_new (g_str_hash, g_str_equal); composer->inline_images_by_url = g_hash_table_new (g_str_hash, g_str_equal); - + composer->current_images = NULL; + composer->attachment_bar_visible = FALSE; composer->send_html = FALSE; composer->pgp_sign = FALSE; -- cgit v1.2.3