diff options
author | Dan Winship <danw@src.gnome.org> | 2000-05-09 06:28:11 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2000-05-09 06:28:11 +0800 |
commit | 38165888d297d91e1bdf5f1ac6027b900b23b740 (patch) | |
tree | f4f75d5c426ff0e7422b22ddd543b90fdc0c1a05 | |
parent | 65ec43cb553420890c8d14b6c76ce2606674d893 (diff) | |
download | gsoc2013-evolution-38165888d297d91e1bdf5f1ac6027b900b23b740.tar.gz gsoc2013-evolution-38165888d297d91e1bdf5f1ac6027b900b23b740.tar.zst gsoc2013-evolution-38165888d297d91e1bdf5f1ac6027b900b23b740.zip |
Update for CamelStream CamelException changes.
* mail-display.c (save_data_cb):
(on_url_requested): Update for CamelStream CamelException changes.
* mail-format.c: Pass NULL for a CamelException in a bunch of
places... the user will see that the data is not being displayed,
and there's not a lot we can do, and none of these things should
be failing anyway. Maybe fix this later.
svn path=/trunk/; revision=2925
-rw-r--r-- | mail/ChangeLog | 10 | ||||
-rw-r--r-- | mail/mail-display.c | 24 | ||||
-rw-r--r-- | mail/mail-format.c | 18 |
3 files changed, 37 insertions, 15 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 69a9cb8a86..e6f2d4605b 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,13 @@ +2000-05-08 Dan Winship <danw@helixcode.com> + + * mail-display.c (save_data_cb): + (on_url_requested): Update for CamelStream CamelException changes. + + * mail-format.c: Pass NULL for a CamelException in a bunch of + places... the user will see that the data is not being displayed, + and there's not a lot we can do, and none of these things should + be failing anyway. Maybe fix this later. + 2000-05-07 NotZed <NotZed@HelixCode.com> * message-list.c (ml_value_at): Size moved to message info, rather diff --git a/mail/mail-display.c b/mail/mail-display.c index bee6e9cc74..0e7eac06e1 100644 --- a/mail/mail-display.c +++ b/mail/mail-display.c @@ -44,6 +44,7 @@ save_data_cb (GtkWidget *widget, gpointer user_data) gtk_widget_get_ancestor (widget, GTK_TYPE_FILE_SELECTION); char *name, buf[1024]; int fd, nread; + CamelException *ex; name = gtk_file_selection_get_filename (file_select); @@ -69,14 +70,24 @@ save_data_cb (GtkWidget *widget, gpointer user_data) return; } - camel_stream_reset (output); - do { - nread = camel_stream_read (output, buf, sizeof (buf)); + ex = camel_exception_new (); + camel_stream_reset (output, ex); + while (!camel_exception_is_set (ex) && !camel_stream_eos (output)) { + nread = camel_stream_read (output, buf, sizeof (buf), ex); if (nread > 0) write (fd, buf, nread); - } while (!camel_stream_eos (output)); + } close (fd); + if (camel_exception_is_set (ex)) { + char *msg; + + msg = g_strdup_printf ("Could not write data: %s", + camel_exception_get_description (ex)); + gnome_error_dialog_parented (msg, GTK_WINDOW (file_select)); + } + camel_exception_free (ex); + gtk_widget_destroy (GTK_WIDGET (file_select)); } @@ -163,9 +174,10 @@ on_url_requested (GtkHTML *html, const char *url, GtkHTMLStreamHandle handle, output = camel_data_wrapper_get_output_stream (data); g_return_if_fail (CAMEL_IS_STREAM (output)); - camel_stream_reset (output); + camel_stream_reset (output, NULL); do { - nread = camel_stream_read (output, buf, sizeof (buf)); + nread = camel_stream_read (output, buf, + sizeof (buf), NULL); if (nread > 0) gtk_html_write (html, handle, buf, nread); } while (!camel_stream_eos (output)); diff --git a/mail/mail-format.c b/mail/mail-format.c index 12026a5ce7..486b4da0b5 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); + camel_data_wrapper_write_to_stream (data, memstream, NULL); text = g_malloc (ba->len + 1); memcpy (text, ba->data, ba->len); text[ba->len] = '\0'; @@ -485,14 +485,14 @@ handle_text_plain_flowed (CamelMimePart *part, CamelMimeMessage *root, /* Get the output stream of the data wrapper. */ wrapper_output_stream = camel_data_wrapper_get_output_stream (wrapper); - camel_stream_reset (wrapper_output_stream); + camel_stream_reset (wrapper_output_stream, NULL); buffer = camel_stream_buffer_new (wrapper_output_stream, CAMEL_STREAM_BUFFER_READ); do { /* Read next chunk of text. */ line = camel_stream_buffer_read_line ( - CAMEL_STREAM_BUFFER (buffer)); + CAMEL_STREAM_BUFFER (buffer), NULL); if (!line) break; @@ -593,7 +593,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); + camel_data_wrapper_write_to_stream (wrapper, memstream, NULL); g_byte_array_append (ba, "", 1); p = ba->data; @@ -688,12 +688,12 @@ handle_text_html (CamelMimePart *part, CamelMimeMessage *root, GtkBox *box) /* Get the output stream of the data wrapper. */ wrapper_output_stream = camel_data_wrapper_get_output_stream (wrapper); - camel_stream_reset (wrapper_output_stream); + camel_stream_reset (wrapper_output_stream, NULL); do { /* Read next chunk of text. */ nb_bytes_read = camel_stream_read (wrapper_output_stream, - tmp_buffer, 4096); + tmp_buffer, 4096, NULL); /* If there's any text, write it to the stream */ if (nb_bytes_read > 0) { @@ -1057,7 +1057,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); + camel_data_wrapper_write_to_stream (wrapper, cstream, NULL); /* ...convert the CamelStreamMem to a BonoboStreamMem... */ bstream = bonobo_stream_mem_create (ba->data, ba->len, TRUE, FALSE); @@ -1350,8 +1350,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); - camel_stream_flush (stream); + stream, NULL); + camel_stream_flush (stream, NULL); gtk_object_unref (GTK_OBJECT (stream)); composer = E_MSG_COMPOSER (e_msg_composer_new ()); |