From ccd4d84234d933ccf05769e71a3372e149d707d1 Mon Sep 17 00:00:00 2001 From: NotZed Date: Fri, 19 May 2000 19:59:06 +0000 Subject: Fixes for stream stuff. 2000-05-19 NotZed * mail-format.c: Fixes for stream stuff. * mail-display.c (save_data_cb): Remove exception stuff on streams. svn path=/trunk/; revision=3143 --- mail/ChangeLog | 6 ++++++ mail/mail-display.c | 17 +++++------------ mail/mail-format.c | 11 +++++------ 3 files changed, 16 insertions(+), 18 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index f81e6bc148..0b68569706 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,9 @@ +2000-05-19 NotZed + + * mail-format.c: Fixes for stream stuff. + + * mail-display.c (save_data_cb): Remove exception stuff on streams. + 2000-05-19 Christopher James Lahey * message-list.c: Added initialize_value and value_is_empty diff --git a/mail/mail-display.c b/mail/mail-display.c index 5b455c0c5f..d569ba1f7c 100644 --- a/mail/mail-display.c +++ b/mail/mail-display.c @@ -45,7 +45,6 @@ save_data_cb (GtkWidget *widget, gpointer user_data) gtk_widget_get_ancestor (widget, GTK_TYPE_FILE_SELECTION); char *name; int fd; - CamelException *ex; name = gtk_file_selection_get_filename (file_select); @@ -72,20 +71,14 @@ save_data_cb (GtkWidget *widget, gpointer user_data) } stream_fs = camel_stream_fs_new_with_fd (fd); - ex = camel_exception_new (); - camel_data_wrapper_write_to_stream (data, stream_fs, ex); - if (!camel_exception_is_set (ex)) - camel_stream_flush (stream_fs, ex); - gtk_object_unref (GTK_OBJECT (stream_fs)); - - if (camel_exception_is_set (ex)) { + if (camel_data_wrapper_write_to_stream (data, stream_fs) == -1 + || camel_stream_flush (stream_fs) == -1) { char *msg; - msg = g_strdup_printf ("Could not write data: %s", - camel_exception_get_description (ex)); + msg = g_strdup_printf ("Could not write data: %s", strerror(errno)); gnome_error_dialog_parented (msg, GTK_WINDOW (file_select)); } - camel_exception_free (ex); + gtk_object_unref (GTK_OBJECT (stream_fs)); gtk_widget_destroy (GTK_WIDGET (file_select)); } @@ -173,7 +166,7 @@ on_url_requested (GtkHTML *html, const char *url, GtkHTMLStreamHandle handle, ba = g_byte_array_new (); stream_mem = camel_stream_mem_new_with_byte_array (ba); - camel_data_wrapper_write_to_stream (data, stream_mem, NULL); + camel_data_wrapper_write_to_stream (data, stream_mem); gtk_html_write (html, handle, ba->data, ba->len); gtk_object_unref (GTK_OBJECT (stream_mem)); } else diff --git a/mail/mail-format.c b/mail/mail-format.c index f1a1f3e552..fc5d321cec 100644 --- a/mail/mail-format.c +++ b/mail/mail-format.c @@ -418,7 +418,7 @@ get_data_wrapper_text (CamelDataWrapper *data) ba = g_byte_array_new (); memstream = camel_stream_mem_new_with_byte_array (ba); - camel_data_wrapper_write_to_stream (data, memstream, NULL); + camel_data_wrapper_write_to_stream (data, memstream); text = g_malloc (ba->len + 1); memcpy (text, ba->data, ba->len); text[ba->len] = '\0'; @@ -587,7 +587,7 @@ handle_text_enriched (CamelMimePart *part, CamelMimeMessage *root, GtkBox *box) ba = g_byte_array_new (); memstream = camel_stream_mem_new_with_byte_array (ba); - camel_data_wrapper_write_to_stream (wrapper, memstream, NULL); + camel_data_wrapper_write_to_stream (wrapper, memstream); g_byte_array_append (ba, "", 1); p = ba->data; @@ -1029,7 +1029,7 @@ handle_via_bonobo (CamelMimePart *part, CamelMimeMessage *root, GtkBox *box) /* Write the data to a CamelStreamMem... */ ba = g_byte_array_new (); cstream = camel_stream_mem_new_with_byte_array (ba); - camel_data_wrapper_write_to_stream (wrapper, cstream, NULL); + camel_data_wrapper_write_to_stream (wrapper, cstream); /* ...convert the CamelStreamMem to a BonoboStreamMem... */ bstream = bonobo_stream_mem_create (ba->data, ba->len, TRUE, FALSE); @@ -1321,9 +1321,8 @@ mail_generate_forward (CamelMimeMessage *mime_message, } stream = camel_stream_fs_new_with_fd (fd); - camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (mime_message), - stream, NULL); - camel_stream_flush (stream, NULL); + camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (mime_message), stream); + camel_stream_flush (stream); gtk_object_unref (GTK_OBJECT (stream)); composer = E_MSG_COMPOSER (e_msg_composer_new ()); -- cgit