aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-display.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-01-26 01:07:23 +0800
committerDan Winship <danw@src.gnome.org>2001-01-26 01:07:23 +0800
commit54a2910f896626046666ffa8d88f052acdb5c201 (patch)
treeeef885546b87b45417383993478c60ef6363b516 /mail/mail-display.c
parent9100d6bcdd7928ddd74587ba58367658816bffe5 (diff)
downloadgsoc2013-evolution-54a2910f896626046666ffa8d88f052acdb5c201.tar.gz
gsoc2013-evolution-54a2910f896626046666ffa8d88f052acdb5c201.tar.zst
gsoc2013-evolution-54a2910f896626046666ffa8d88f052acdb5c201.zip
Check if a message part's content is available, and if it's not, queue a
* mail-format.c (mail_content_loaded): Check if a message part's content is available, and if it's not, queue a thread that will load it and then queue an idle-handler redisplay of the message. (call_handler_function): Call mail_content_loaded() on the part and don't try to display it if it's currently offline. (get_data_wrapper_text): Simplify a bit * mail-display.c (mail_display_queue_redisplay): rename and make non-static. (mail_display_redisplay): Use a "new and improved" way of preserving the GtkHTML scroll location. ("new and improved" is code for "gross and hackish", but there should be a real interface for this eventually.) (on_url_requested): Use mail_content_loaded() and don't write out offline cid: URLs * mail-identify.c (mail_identify_mime_part): Use mail_content_loaded and don't try to identify the data if it's offline. svn path=/trunk/; revision=7813
Diffstat (limited to 'mail/mail-display.c')
-rw-r--r--mail/mail-display.c64
1 files changed, 23 insertions, 41 deletions
diff --git a/mail/mail-display.c b/mail/mail-display.c
index c585ec0eac..31ec089f46 100644
--- a/mail/mail-display.c
+++ b/mail/mail-display.c
@@ -32,13 +32,12 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk-pixbuf/gdk-pixbuf-loader.h>
#include <gtkhtml/gtkhtml-embedded.h>
+#include <gtkhtml/htmlengine.h> /* XXX */
#define PARENT_TYPE (gtk_vbox_get_type ())
static GtkObjectClass *mail_display_parent_class;
-static void redisplay (MailDisplay *md, gboolean unscroll);
-
struct _PixbufLoader {
MailDisplay *md;
CamelDataWrapper *wrapper; /* The data */
@@ -186,12 +185,12 @@ idle_redisplay (gpointer data)
MailDisplay *md = data;
md->idle_id = 0;
- redisplay (md, FALSE);
+ mail_display_redisplay (md, FALSE);
return FALSE;
}
-static void
-queue_redisplay (MailDisplay *md)
+void
+mail_display_queue_redisplay (MailDisplay *md)
{
if (!md->idle_id) {
md->idle_id = g_idle_add_full (G_PRIORITY_LOW, idle_redisplay,
@@ -212,7 +211,7 @@ on_link_clicked (GtkHTML *html, const char *url, gpointer user_data)
else if (!strcmp (url, "x-evolution-decode-pgp:")) {
g_datalist_set_data (md->data, "show_pgp",
GINT_TO_POINTER (1));
- queue_redisplay (md);
+ mail_display_queue_redisplay (md);
} else
gnome_url_show (url);
}
@@ -301,7 +300,7 @@ inline_cb (GtkWidget *widget, gpointer user_data)
else
camel_mime_part_set_disposition (part, "inline");
- queue_redisplay (md);
+ mail_display_queue_redisplay (md);
}
static gboolean
@@ -767,6 +766,8 @@ on_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle,
g_return_if_fail (CAMEL_IS_MEDIUM (medium));
data = camel_medium_get_content_object (medium);
+ if (!mail_content_loaded (data, md))
+ return;
ba = g_byte_array_new ();
stream_mem = camel_stream_mem_new_with_byte_array (ba);
@@ -844,17 +845,24 @@ clear_data (CamelObject *object, gpointer event_data, gpointer user_data)
g_datalist_clear (&data);
}
-static void
-redisplay (MailDisplay *md, gboolean unscroll)
+/**
+ * mail_display_redisplay:
+ * @mail_display: the mail display object
+ * @unscroll: specifies whether or not to lose current scroll
+ *
+ * Force a redraw of the message display.
+ **/
+void
+mail_display_redisplay (MailDisplay *md, gboolean unscroll)
{
- GtkAdjustment *adj;
- gfloat oldv = 0;
+ printf("redisplaying\n");
+ md->stream = gtk_html_begin (GTK_HTML (md->html));
if (!unscroll) {
- adj = e_scroll_frame_get_vadjustment (md->scroll);
- oldv = adj->value;
+ /* This is a hack until there's a clean way to do this. */
+ GTK_HTML (md->html)->engine->newPage = FALSE;
}
- md->stream = gtk_html_begin (GTK_HTML (md->html));
+
mail_html_write (md->html, md->stream, "%s%s", HTML_HEADER, "<BODY>\n");
if (md->current_message) {
@@ -868,32 +876,6 @@ redisplay (MailDisplay *md, gboolean unscroll)
mail_html_write (md->html, md->stream, "</BODY></HTML>\n");
gtk_html_end (md->html, md->stream, GTK_HTML_STREAM_OK);
md->stream = NULL;
-
- if (unscroll) {
- adj = e_scroll_frame_get_hadjustment (md->scroll);
- gtk_adjustment_set_value (adj, 0);
- e_scroll_frame_set_hadjustment (md->scroll, adj);
- } else {
- adj = e_scroll_frame_get_vadjustment (md->scroll);
- if (oldv < adj->upper) {
- gtk_adjustment_set_value (adj, oldv);
- e_scroll_frame_set_vadjustment (md->scroll, adj);
- }
- }
-}
-
-
-/**
- * mail_display_redisplay:
- * @mail_display: the mail display object
- * @unscroll: specifies whether or not to lose current scroll
- *
- * Force a redraw of the message display.
- **/
-void
-mail_display_redisplay (MailDisplay *mail_display, gboolean unscroll)
-{
- redisplay (mail_display, unscroll);
}
/**
@@ -920,7 +902,7 @@ mail_display_set_message (MailDisplay *md, CamelMedium *medium)
md->current_message = (CamelMimeMessage*)medium;
g_datalist_init (md->data);
- redisplay (md, TRUE);
+ mail_display_redisplay (md, TRUE);
if (medium) {
camel_object_hook_event (CAMEL_OBJECT (medium), "finalize",
clear_data, *(md->data));