aboutsummaryrefslogtreecommitdiffstats
path: root/composer/e-msg-composer-attachment.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2003-08-14 00:30:35 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2003-08-14 00:30:35 +0800
commit3c7a8efeadf4c7ced34a16249d0876b6d09a3dbb (patch)
treee5292e5467acdaca8aa89b232d199e4fd0c81af1 /composer/e-msg-composer-attachment.c
parenta8ef795eb902d073b6975529106de3dd830b32fc (diff)
downloadgsoc2013-evolution-3c7a8efeadf4c7ced34a16249d0876b6d09a3dbb.tar.gz
gsoc2013-evolution-3c7a8efeadf4c7ced34a16249d0876b6d09a3dbb.tar.zst
gsoc2013-evolution-3c7a8efeadf4c7ced34a16249d0876b6d09a3dbb.zip
This needs to use camel_data_wrapper_decode_to_stream() rather than
2003-08-13 Jeffrey Stedfast <fejj@ximian.com> * e-msg-composer-attachment-bar.c (update): This needs to use camel_data_wrapper_decode_to_stream() rather than write_to_stream(). Also simplify a bit - no sense looping to load the pixbuf data into the gdk-pixbuf loader 4K at a time when we have the whole thing in a memory buffer already. Once done, unref the stream instead of closing it so we don't leak. (attach_to_multipart): Use decode_to_stream(). * e-msg-composer-attachment.c (e_msg_composer_attachment_new): Avoid constructing thwe data-wrapper from the stream twice for message/rfc822 parts. svn path=/trunk/; revision=22213
Diffstat (limited to 'composer/e-msg-composer-attachment.c')
-rw-r--r--composer/e-msg-composer-attachment.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/composer/e-msg-composer-attachment.c b/composer/e-msg-composer-attachment.c
index 3d790eb2f2..fb7fe46073 100644
--- a/composer/e-msg-composer-attachment.c
+++ b/composer/e-msg-composer-attachment.c
@@ -186,23 +186,22 @@ e_msg_composer_attachment_new (const char *file_name,
return NULL;
}
- wrapper = camel_data_wrapper_new ();
- camel_data_wrapper_construct_from_stream (wrapper, stream);
-
mime_type = e_msg_composer_guess_mime_type (file_name);
if (mime_type) {
if (!strcasecmp (mime_type, "message/rfc822")) {
- camel_object_unref (wrapper);
wrapper = (CamelDataWrapper *) camel_mime_message_new ();
-
- camel_stream_reset (stream);
- camel_data_wrapper_construct_from_stream (wrapper, stream);
+ } else {
+ wrapper = camel_data_wrapper_new ();
}
+ camel_data_wrapper_construct_from_stream (wrapper, stream);
camel_data_wrapper_set_mime_type (wrapper, mime_type);
g_free (mime_type);
- } else
+ } else {
+ wrapper = camel_data_wrapper_new ();
+ camel_data_wrapper_construct_from_stream (wrapper, stream);
camel_data_wrapper_set_mime_type (wrapper, "application/octet-stream");
+ }
camel_object_unref (stream);
@@ -211,7 +210,7 @@ e_msg_composer_attachment_new (const char *file_name,
camel_object_unref (wrapper);
camel_mime_part_set_disposition (part, disposition);
- filename = g_path_get_basename(file_name);
+ filename = g_path_get_basename (file_name);
camel_mime_part_set_filename (part, filename);
g_free (filename);