From 45dae27911e7740f339fa00674aa08d904f47041 Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Mon, 26 Apr 2004 15:53:15 +0000 Subject: set gtk_html_begin's flags to avoid scroll to top of the message and 2004-04-26 Radek Doulik * em-format-html.c (efh_format_timeout): set gtk_html_begin's flags to avoid scroll to top of the message and reloading+flickering of images * em-html-stream.c: added GtkHTMLBeginFlags flags field (em_html_stream_set_flags): new helper function to set new flags field (emhs_sync_write): use gtk_html_begin_full with new flags field (em_html_stream_new): zero flags field svn path=/trunk/; revision=25616 --- mail/ChangeLog | 12 ++++++++++++ mail/em-format-html.c | 6 +++--- mail/em-html-stream.c | 9 ++++++++- mail/em-html-stream.h | 2 ++ 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index ea0e7ec0fb..c1af15a0c7 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,15 @@ +2004-04-26 Radek Doulik + + * em-format-html.c (efh_format_timeout): set gtk_html_begin's + flags to avoid scroll to top of the message and + reloading+flickering of images + + * em-html-stream.c: added GtkHTMLBeginFlags flags field + (em_html_stream_set_flags): new helper function to set new flags + field + (emhs_sync_write): use gtk_html_begin_full with new flags field + (em_html_stream_new): zero flags field + 2004-04-23 Sarfraaz Ahmed * mail/mail-license.glade: Glade file for displaying the license. diff --git a/mail/em-format-html.c b/mail/em-format-html.c index a7ccb59dee..5302f5b79c 100644 --- a/mail/em-format-html.c +++ b/mail/em-format-html.c @@ -1310,9 +1310,9 @@ efh_format_timeout(struct _format_msg *m) m->estream = (EMHTMLStream *)em_html_stream_new(efh->html, hstream); if (p->last_part == m->message) { - /* HACK: so we redraw in the same spot */ - /* FIXME: It doesn't work! */ - efh->html->engine->newPage = FALSE; + em_html_stream_set_flags (m->estream, + GTK_HTML_BEGIN_KEEP_SCROLL | GTK_HTML_BEGIN_KEEP_IMAGES + | GTK_HTML_BEGIN_BLOCK_UPDATES | GTK_HTML_BEGIN_BLOCK_IMAGES); } else { /* clear cache of inline-scanned text parts */ g_hash_table_foreach(p->text_inline_parts, efh_free_inline_parts, NULL); diff --git a/mail/em-html-stream.c b/mail/em-html-stream.c index 955525c306..5b217a7a05 100644 --- a/mail/em-html-stream.c +++ b/mail/em-html-stream.c @@ -109,7 +109,7 @@ emhs_sync_write(CamelStream *stream, const char *buffer, size_t n) return -1; if (emhs->html_stream == NULL) - emhs->html_stream = gtk_html_begin(emhs->html); + emhs->html_stream = gtk_html_begin_full (emhs->html, NULL, NULL, emhs->flags); gtk_html_stream_write(emhs->html_stream, buffer, n); @@ -160,6 +160,7 @@ em_html_stream_new(struct _GtkHTML *html, struct _GtkHTMLStream *html_stream) new = EM_HTML_STREAM (camel_object_new (EM_HTML_STREAM_TYPE)); new->html_stream = html_stream; new->html = html; + new->flags = 0; g_object_ref(html); new->destroy_id = g_signal_connect(html, "destroy", G_CALLBACK(emhs_gtkhtml_destroy), new); @@ -167,3 +168,9 @@ em_html_stream_new(struct _GtkHTML *html, struct _GtkHTMLStream *html_stream) return (CamelStream *)new; } + +void +em_html_stream_set_flags (EMHTMLStream *emhs, GtkHTMLBeginFlags flags) +{ + emhs->flags = flags; +} diff --git a/mail/em-html-stream.h b/mail/em-html-stream.h index dc4b59cde8..e30c64918b 100644 --- a/mail/em-html-stream.h +++ b/mail/em-html-stream.h @@ -44,6 +44,7 @@ typedef struct _EMHTMLStream { guint destroy_id; struct _GtkHTML *html; struct _GtkHTMLStream *html_stream; + GtkHTMLBeginFlags flags; } EMHTMLStream; typedef struct { @@ -56,6 +57,7 @@ CamelType em_html_stream_get_type (void); /* the html_stream is closed when we are finalised (with an error), or closed (ok) */ CamelStream *em_html_stream_new(struct _GtkHTML *html, struct _GtkHTMLStream *html_stream); +void em_html_stream_set_flags (EMHTMLStream *emhs, GtkHTMLBeginFlags flags); #ifdef __cplusplus } -- cgit