diff options
author | Larry Ewing <lewing@ximian.com> | 2001-10-30 07:30:25 +0800 |
---|---|---|
committer | Larry Ewing <lewing@src.gnome.org> | 2001-10-30 07:30:25 +0800 |
commit | 80fffd093013bd250c98e1a05591de1a0b029f5a (patch) | |
tree | e9345a3e89c55afe88da4c084760a4c1728746ab /composer/e-msg-composer.c | |
parent | 921c64fb60dfb696590d45f2521a041213a91b0a (diff) | |
download | gsoc2013-evolution-80fffd093013bd250c98e1a05591de1a0b029f5a.tar.gz gsoc2013-evolution-80fffd093013bd250c98e1a05591de1a0b029f5a.tar.zst gsoc2013-evolution-80fffd093013bd250c98e1a05591de1a0b029f5a.zip |
add GList to hold the current images.
2001-10-29 Larry Ewing <lewing@ximian.com>
* 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
Diffstat (limited to 'composer/e-msg-composer.c')
-rw-r--r-- | composer/e-msg-composer.c | 33 |
1 files changed, 23 insertions, 10 deletions
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) { @@ -261,15 +268,16 @@ e_msg_composer_clear_inlined_table (EMsgComposer *composer) } 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; |