turn off blocking writes. (efh_format_timeout): don't do a htmlbegin on

2003-10-01  Not Zed  <NotZed@Ximian.com>

        * em-format-html.c (efh_init): turn off blocking writes.
        (efh_format_timeout): don't do a htmlbegin on the page yet, it'll
        be handled by em-html-stream when it has data, to reduce flicker.
        (efh_format_do): close the main gtkhtml stream as soon as we're
        done writing the body.  any sub-jobs should be using frames etc.
        (efh_text_plain): dont write a table around the text, try to
        reduce flickering.  layout may be out now though.

        * em-html-stream.c (emhs_sync_write): if we have no html_stream
        yet, begin a new one.

svn path=/trunk/; revision=22784
This commit is contained in:
Not Zed
2003-10-02 04:26:03 +00:00
committed by Michael Zucci
parent 14cc184b53
commit 060d4b7e0a
3 changed files with 28 additions and 16 deletions

View File

@ -1,3 +1,16 @@
2003-10-01 Not Zed <NotZed@Ximian.com>
* em-format-html.c (efh_init): turn off blocking writes.
(efh_format_timeout): don't do a htmlbegin on the page yet, it'll
be handled by em-html-stream when it has data, to reduce flicker.
(efh_format_do): close the main gtkhtml stream as soon as we're
done writing the body. any sub-jobs should be using frames etc.
(efh_text_plain): dont write a table around the text, try to
reduce flickering. layout may be out now though.
* em-html-stream.c (emhs_sync_write): if we have no html_stream
yet, begin a new one.
2003-09-30 Rodney Dawes <dobey@ximian.com>
* em-format-html-print.c: Use "Sans Regular" instead of "Helvetica"

View File

@ -119,7 +119,7 @@ efh_init(GObject *o)
efh->priv->text_inline_parts = g_hash_table_new(NULL, NULL);
efh->html = (GtkHTML *)gtk_html_new();
gtk_html_set_blocking (efh->html, TRUE);
gtk_html_set_blocking(efh->html, FALSE);
g_object_ref(efh->html);
gtk_object_sink((GtkObject *)efh->html);
@ -609,10 +609,10 @@ efh_text_plain(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFo
type = camel_mime_part_get_content_type(newpart);
if (camel_content_type_is (type, "text", "plain")) {
camel_stream_write_string(stream, "<table><tr><td><tt>\n");
camel_stream_write_string(stream, "<tt>\n");
em_format_format_text((EMFormat *)efh, (CamelStream *)filtered_stream, camel_medium_get_content_object((CamelMedium *)newpart));
camel_stream_flush((CamelStream *)filtered_stream);
camel_stream_write_string(stream, "</tt></td></tr></table>\n");
camel_stream_write_string(stream, "</tt>\n");
} else {
em_format_part((EMFormat *)efh, stream, newpart);
}
@ -1086,7 +1086,11 @@ static void efh_format_do(struct _mail_msg *mm)
em_format_format_source((EMFormat *)m->format, (CamelStream *)m->estream, (CamelMimePart *)m->message);
else
em_format_format_message((EMFormat *)m->format, (CamelStream *)m->estream, m->message);
camel_stream_flush((CamelStream *)m->estream);
camel_stream_write_string((CamelStream *)m->estream, "</body>\n</html>\n");
camel_stream_close((CamelStream *)m->estream);
camel_object_unref(m->estream);
m->estream = NULL;
puri_level = ((EMFormat *)m->format)->pending_uri_level;
base = ((EMFormat *)m->format)->base;
@ -1117,20 +1121,11 @@ static void efh_format_do(struct _mail_msg *mm)
camel_url_free(job->base);
g_free(job);
/* incase anything got added above, force it through */
camel_stream_flush((CamelStream *)m->estream);
g_mutex_lock(m->format->priv->lock);
}
g_mutex_unlock(m->format->priv->lock);
d(printf("out of jobs, done\n"));
camel_stream_write_string((CamelStream *)m->estream, "</body>\n</html>\n");
camel_stream_close((CamelStream *)m->estream);
camel_object_unref(m->estream);
m->estream = NULL;
((EMFormat *)m->format)->pending_uri_level = puri_level;
}
@ -1198,7 +1193,8 @@ efh_format_timeout(struct _format_msg *m)
gtk_html_stream_close(hstream, GTK_HTML_STREAM_OK);
mail_msg_free(m);
} else {
hstream = gtk_html_begin(efh->html);
/*hstream = gtk_html_begin(efh->html);*/
hstream = NULL;
m->estream = (EMHTMLStream *)em_html_stream_new(efh->html, hstream);
if (p->last_part == m->message) {

View File

@ -105,9 +105,12 @@ emhs_sync_write(CamelStream *stream, const char *buffer, size_t n)
{
EMHTMLStream *emhs = EM_HTML_STREAM (stream);
if (emhs->html_stream == NULL)
if (emhs->html == NULL)
return -1;
if (emhs->html_stream == NULL)
emhs->html_stream = gtk_html_begin(emhs->html);
gtk_html_stream_write(emhs->html_stream, buffer, n);
return (ssize_t) n;
@ -162,7 +165,7 @@ em_html_stream_new(struct _GtkHTML *html, struct _GtkHTMLStream *html_stream)
g_object_ref(html);
new->destroy_id = g_signal_connect(html, "destroy", G_CALLBACK(emhs_gtkhtml_destroy), new);
em_sync_stream_set_buffer_size(&new->sync, 4096);
em_sync_stream_set_buffer_size(&new->sync, 8192);
return (CamelStream *)new;
}