aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorJon Trowbridge <trow@ximian.com>2001-12-12 07:07:22 +0800
committerJon Trowbridge <trow@src.gnome.org>2001-12-12 07:07:22 +0800
commitd91cf0898122e1bac8742665b439fd98ceaa015f (patch)
tree69ecba04eb25889d89e0c2f5ef85824a288bc4f9 /mail
parent3e70bbe666c1ea68383315c0659aee3757f18cd3 (diff)
downloadgsoc2013-evolution-d91cf0898122e1bac8742665b439fd98ceaa015f.tar.gz
gsoc2013-evolution-d91cf0898122e1bac8742665b439fd98ceaa015f.tar.zst
gsoc2013-evolution-d91cf0898122e1bac8742665b439fd98ceaa015f.zip
Fixed for mail_content_loaded's new signature.
2001-12-11 Jon Trowbridge <trow@ximian.com> * mail-identify.c (mail_identify_mime_part): Fixed for mail_content_loaded's new signature. * mail-format.c (attachment_header): Don't convert URLs, etc. if we are printing. (write_address): Don't convert addresses to mailto: links if we are printing. (write_one_text_plain_chunk): Add a printing flag, that we pass along to mail_text_write. (handle_text_plain): Pass our printing flag to write_one_text_plain_chunk. (mail_get_message_rfc822): Don't unneccesarily convert URLs. (mail_content_loaded): Add a GtkHTML parameter. * mail-display.c (mail_display_initialize_gtkhtml): Added. Breaks all of the signal hookups out of mail_display_new. (mail_display_new): Call mail_display_initialize_gtkhtml. (mail_text_write): Don't convert URLs, etc., if we are printing. Lots of other changes to pass around GtkHTML/GtkHTMLStream objects. * mail-callbacks.c (do_mail_print): Call mail_display_initialize_gtkhtml on our GtkHTML object. * folder-browser.c (update_status_bar): Make the status bar more useful when you have a large number of hidden messages. svn path=/trunk/; revision=14997
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog26
-rw-r--r--mail/folder-browser.c45
-rw-r--r--mail/mail-callbacks.c42
-rw-r--r--mail/mail-display.c100
-rw-r--r--mail/mail-display.h5
-rw-r--r--mail/mail-format.c63
-rw-r--r--mail/mail-identify.c2
-rw-r--r--mail/mail-stream-gtkhtml.c1
-rw-r--r--mail/mail.h1
9 files changed, 189 insertions, 96 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 821b560f47..ff41ed6419 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,31 @@
2001-12-11 Jon Trowbridge <trow@ximian.com>
+ * mail-identify.c (mail_identify_mime_part): Fixed for
+ mail_content_loaded's new signature.
+
+ * mail-format.c (attachment_header): Don't convert URLs, etc. if
+ we are printing.
+ (write_address): Don't convert addresses to mailto: links if we
+ are printing.
+ (write_one_text_plain_chunk): Add a printing flag, that we pass
+ along to mail_text_write.
+ (handle_text_plain): Pass our printing flag to
+ write_one_text_plain_chunk.
+ (mail_get_message_rfc822): Don't unneccesarily convert URLs.
+ (mail_content_loaded): Add a GtkHTML parameter.
+
+ * mail-display.c (mail_display_initialize_gtkhtml): Added. Breaks
+ all of the signal hookups out of mail_display_new.
+ (mail_display_new): Call mail_display_initialize_gtkhtml.
+ (mail_text_write): Don't convert URLs, etc., if we are printing.
+ Lots of other changes to pass around GtkHTML/GtkHTMLStream objects.
+
+ * mail-callbacks.c (do_mail_print): Call
+ mail_display_initialize_gtkhtml on our GtkHTML object.
+
+ * folder-browser.c (update_status_bar): Make the status bar more
+ useful when you have a large number of hidden messages.
+
* message-list.etspec: Add ETable magic for our new "Needs Reply"
column. (The next few entries are for bug #90)
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
index 158ce0cc0e..8375582553 100644
--- a/mail/folder-browser.c
+++ b/mail/folder-browser.c
@@ -718,7 +718,7 @@ static void
update_status_bar(FolderBrowser *fb)
{
CORBA_Environment ev;
- int tmp;
+ int tmp, total;
GString *work;
extern CamelFolder *outbox_folder, *sent_folder;
@@ -727,44 +727,49 @@ update_status_bar(FolderBrowser *fb)
|| fb->shell_view == CORBA_OBJECT_NIL)
return;
- work = g_string_new("");
- g_string_sprintfa(work, _("%d new"), camel_folder_get_unread_message_count(fb->folder));
- tmp = message_list_hidden(fb->message_list);
- if (tmp) {
- g_string_append(work, _(", "));
- g_string_sprintfa(work, _("%d hidden"), tmp);
- }
- tmp = e_selection_model_selected_count(e_tree_get_selection_model(fb->message_list->tree));
- if (tmp) {
- g_string_append(work, _(", "));
- g_string_sprintfa(work, _("%d selected"), tmp);
- }
if (!fb->message_list->hidedeleted || !camel_folder_has_summary_capability(fb->folder)) {
- tmp = camel_folder_get_message_count(fb->folder);
+ total = camel_folder_get_message_count(fb->folder);
} else {
GPtrArray *sum = camel_folder_get_summary(fb->folder);
int i;
if (sum) {
- tmp = 0;
+ total = 0;
for (i=0;i<sum->len;i++) {
CamelMessageInfo *info = sum->pdata[i];
if ((info->flags & CAMEL_MESSAGE_DELETED) == 0)
- tmp++;
+ total++;
}
camel_folder_free_summary(fb->folder, sum);
} else {
- tmp = camel_folder_get_message_count(fb->folder);
+ total = camel_folder_get_message_count(fb->folder);
}
}
+
+ work = g_string_new("");
+ g_string_sprintfa(work, _("%d new"), camel_folder_get_unread_message_count(fb->folder));
+ tmp = message_list_hidden(fb->message_list);
+ if (0 < tmp && tmp < total) {
+ g_string_append(work, _(", "));
+ if (tmp < total / 2)
+ g_string_sprintfa(work, _("%d hidden"), tmp);
+ else
+ g_string_sprintfa(work, _("%d visible"), total - tmp);
+ }
+ tmp = e_selection_model_selected_count(e_tree_get_selection_model(fb->message_list->tree));
+ if (tmp) {
+ g_string_append(work, _(", "));
+ g_string_sprintfa(work, _("%d selected"), tmp);
+ }
g_string_append(work, _(", "));
+
if (fb->folder == outbox_folder)
- g_string_sprintfa(work, _("%d unsent"), tmp);
+ g_string_sprintfa(work, _("%d unsent"), total);
else if (fb->folder == sent_folder)
- g_string_sprintfa(work, _("%d sent"), tmp);
+ g_string_sprintfa(work, _("%d sent"), total);
else
- g_string_sprintfa(work, _("%d total"), tmp);
+ g_string_sprintfa(work, _("%d total"), total);
CORBA_exception_init(&ev);
GNOME_Evolution_ShellView_setFolderBarLabel(fb->shell_view, work->str, &ev);
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index 8a5429b3e6..637c01c17f 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -2326,11 +2326,31 @@ providers_config (BonoboUIComponent *uih, void *user_data, const char *path)
}
}
-/*
- * FIXME: This routine could be made generic, by having a closure
- * function plus data, and having the whole process be taken care
- * of for you
- */
+#define HEADER_HEIGHT 1.1
+#define FOOTER_HEIGHT 1.1
+
+static void
+header_print_cb (GtkHTML *html, GnomePrintContext *print_context,
+ double x, double y, double width, double height, gpointer user_data)
+{
+#if 0
+ gnome_print_setlinewidth (print_context, 12);
+ gnome_print_setrgbcolor (print_context, 1.0, 0.0, 0.0);
+
+ gnome_print_newpath (print_context);
+ gnome_print_moveto (print_context, x, y);
+ gnome_print_lineto (print_context, x+width, y+height);
+ gnome_print_strokepath (print_context);
+#endif
+}
+
+static void
+footer_print_cb (GtkHTML *html, GnomePrintContext *print_context,
+ double x, double y, double width, double height, gpointer user_data)
+{
+
+}
+
static void
do_mail_print (FolderBrowser *fb, gboolean preview)
{
@@ -2375,6 +2395,7 @@ do_mail_print (FolderBrowser *fb, gboolean preview)
print_context = gnome_print_master_get_context (print_master);
html = GTK_HTML (gtk_html_new ());
+ mail_display_initialize_gtkhtml (fb->mail_display, html);
/* Set our 'printing' flag to true and render. This causes us
to ignoring any adjustments we made to accomodate the
@@ -2383,11 +2404,17 @@ do_mail_print (FolderBrowser *fb, gboolean preview)
mail_display_render (fb->mail_display, html);
gtk_html_print_set_master (html, print_master);
+
+#if 0
+ gtk_html_print_with_header_footer (html, print_context,
+ HEADER_HEIGHT, FOOTER_HEIGHT,
+ header_print_cb, footer_print_cb,
+ NULL);
+#endif
gtk_html_print (html, print_context);
fb->mail_display->printing = FALSE;
- gtk_object_unref (GTK_OBJECT (html));
gnome_print_master_close (print_master);
if (preview){
@@ -2405,7 +2432,8 @@ do_mail_print (FolderBrowser *fb, gboolean preview)
_("Printing of message failed"));
}
}
- gtk_object_unref (GTK_OBJECT (print_master));
+
+ /* FIXME: We are leaking the GtkHTML object */
}
/* This is pretty evil. FolderBrowser's API should be extended to allow these sorts of
diff --git a/mail/mail-display.c b/mail/mail-display.c
index 437f4bb11e..3111e11922 100644
--- a/mail/mail-display.c
+++ b/mail/mail-display.c
@@ -761,7 +761,7 @@ save_url (MailDisplay *md, const char *url)
g_return_val_if_fail (CAMEL_IS_MIME_PART (part), NULL);
data = camel_medium_get_content_object ((CamelMedium *)part);
- if (!mail_content_loaded (data, md, TRUE, NULL, NULL)) {
+ if (!mail_content_loaded (data, md, TRUE, NULL, NULL, NULL)) {
return NULL;
}
@@ -1052,7 +1052,7 @@ 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, FALSE, url, handle))
+ if (!mail_content_loaded (data, md, FALSE, url, html, handle))
return;
content_type = camel_data_wrapper_get_mime_type_field (data);
@@ -1098,7 +1098,7 @@ on_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle,
g_datalist_get_data (md->data, "load_images")) {
ba = g_byte_array_new ();
g_hash_table_insert (urls, g_strdup (url), ba);
- mail_display_stream_write_when_loaded (md, ba, url, load_http, handle,
+ mail_display_stream_write_when_loaded (md, ba, url, load_http, html, handle,
g_strdup (url));
} else if (mail_config_get_http_mode () == MAIL_CONFIG_HTTP_SOMETIMES &&
!g_datalist_get_data (md->data, "checking_from")) {
@@ -1121,6 +1121,7 @@ struct _load_content_msg {
struct _mail_msg msg;
MailDisplay *display;
+ GtkHTML *html;
GtkHTMLStream *handle;
gint redisplay_counter;
@@ -1162,16 +1163,16 @@ try_part_urls (struct _load_content_msg *m)
g_return_val_if_fail (CAMEL_IS_MEDIUM (medium), FALSE);
data = camel_medium_get_content_object (medium);
- if (!mail_content_loaded (data, m->display, FALSE, m->url, m->handle)) {
+ if (!mail_content_loaded (data, m->display, FALSE, m->url, m->html, m->handle)) {
g_warning ("This code should not be reached\n");
return TRUE;
}
- html_stream = mail_stream_gtkhtml_new (m->display->html, m->handle);
+ html_stream = mail_stream_gtkhtml_new (m->html, m->handle);
camel_data_wrapper_write_to_stream (data, html_stream);
camel_object_unref (CAMEL_OBJECT (html_stream));
- gtk_html_end (m->display->html, m->handle, GTK_HTML_STREAM_OK);
+ gtk_html_end (m->html, m->handle, GTK_HTML_STREAM_OK);
return TRUE;
}
@@ -1191,9 +1192,9 @@ try_data_urls (struct _load_content_msg *m)
if (ba) {
if (ba->len) {
printf ("writing ...\n");
- gtk_html_write (m->display->html, m->handle, ba->data, ba->len);
+ gtk_html_write (m->html, m->handle, ba->data, ba->len);
}
- gtk_html_end (m->display->html, m->handle, GTK_HTML_STREAM_OK);
+ gtk_html_end (m->html, m->handle, GTK_HTML_STREAM_OK);
return TRUE;
}
@@ -1215,7 +1216,7 @@ load_content_loaded (struct _mail_msg *mm)
m->display->redisplay_counter);
if (m->redisplay_counter == m->display->redisplay_counter) {
if (!try_part_urls (m) && !try_data_urls (m))
- gtk_html_end (m->display->html, m->handle, GTK_HTML_STREAM_ERROR);
+ gtk_html_end (m->html, m->handle, GTK_HTML_STREAM_ERROR);
}
} else
mail_display_redisplay (m->display, FALSE);
@@ -1241,6 +1242,7 @@ static struct _mail_msg_op load_content_op = {
static void
stream_write_or_redisplay_when_loaded (MailDisplay *md,
+ GtkHTML *html,
gconstpointer key,
const gchar *url,
void (*callback)(MailDisplay *, gpointer),
@@ -1267,6 +1269,7 @@ stream_write_or_redisplay_when_loaded (MailDisplay *md,
m = mail_msg_new (&load_content_op, NULL, sizeof (*m));
m->display = md;
gtk_object_ref (GTK_OBJECT (m->display));
+ m->html = html;
m->handle = handle;
m->url = g_strdup (url);
m->redisplay_counter = md->redisplay_counter;
@@ -1284,32 +1287,38 @@ mail_display_stream_write_when_loaded (MailDisplay *md,
gconstpointer key,
const gchar *url,
void (*callback)(MailDisplay *, gpointer),
+ GtkHTML *html,
GtkHTMLStream *handle,
gpointer data)
{
- stream_write_or_redisplay_when_loaded (md, key, url, callback, handle, data);
+ stream_write_or_redisplay_when_loaded (md, html, key, url, callback, handle, data);
}
void
mail_display_redisplay_when_loaded (MailDisplay *md,
gconstpointer key,
void (*callback)(MailDisplay *, gpointer),
+ GtkHTML *html,
gpointer data)
{
- stream_write_or_redisplay_when_loaded (md, key, NULL, callback, NULL, data);
+ stream_write_or_redisplay_when_loaded (md, html, key, NULL, callback, NULL, data);
}
void
-mail_text_write (GtkHTML *html, GtkHTMLStream *stream, const char *text)
+mail_text_write (GtkHTML *html, GtkHTMLStream *stream, gboolean printing, const char *text)
{
+ guint flags;
char *htmltext;
+
+ flags = E_TEXT_TO_HTML_CONVERT_NL | E_TEXT_TO_HTML_CONVERT_SPACES;
+
+ if (! printing)
+ flags |= E_TEXT_TO_HTML_CONVERT_URLS | E_TEXT_TO_HTML_CONVERT_ADDRESSES;
+
+ if (mail_config_get_citation_highlight () && ! printing)
+ flags |= E_TEXT_TO_HTML_MARK_CITATION;
- htmltext = e_text_to_html_full (text, E_TEXT_TO_HTML_CONVERT_URLS |
- E_TEXT_TO_HTML_CONVERT_ADDRESSES |
- E_TEXT_TO_HTML_CONVERT_NL |
- E_TEXT_TO_HTML_CONVERT_SPACES |
- (mail_config_get_citation_highlight () ? E_TEXT_TO_HTML_MARK_CITATION : 0),
- mail_config_get_citation_color ());
+ htmltext = e_text_to_html_full (text, flags, mail_config_get_citation_color ());
gtk_html_write (html, stream, "<tt>", 4);
gtk_html_write (html, stream, htmltext, strlen (htmltext));
@@ -2073,29 +2082,7 @@ mail_display_new (void)
html_engine_set_tokenizer (GTK_HTML (html)->engine, tok);
gtk_object_unref (GTK_OBJECT (tok));
- gtk_html_set_default_content_type (GTK_HTML (html),
- "text/html; charset=utf-8");
-
- gtk_html_set_editable (GTK_HTML (html), FALSE);
- gtk_signal_connect (GTK_OBJECT (html), "url_requested",
- GTK_SIGNAL_FUNC (on_url_requested),
- mail_display);
- gtk_signal_connect (GTK_OBJECT (html), "object_requested",
- GTK_SIGNAL_FUNC (on_object_requested),
- mail_display);
- gtk_signal_connect (GTK_OBJECT (html), "link_clicked",
- GTK_SIGNAL_FUNC (on_link_clicked),
- mail_display);
- gtk_signal_connect (GTK_OBJECT (html), "button_press_event",
- GTK_SIGNAL_FUNC (html_button_press_event), mail_display);
- gtk_signal_connect (GTK_OBJECT (html), "motion_notify_event",
- GTK_SIGNAL_FUNC (html_motion_notify_event), mail_display);
- gtk_signal_connect (GTK_OBJECT (html), "enter_notify_event",
- GTK_SIGNAL_FUNC (html_enter_notify_event), mail_display);
- gtk_signal_connect (GTK_OBJECT (html), "iframe_created",
- GTK_SIGNAL_FUNC (html_iframe_created), mail_display);
- gtk_signal_connect (GTK_OBJECT (html), "on_url",
- GTK_SIGNAL_FUNC (html_on_url), mail_display);
+ mail_display_initialize_gtkhtml (mail_display, GTK_HTML (html));
gtk_container_add (GTK_CONTAINER (scroll), html);
gtk_widget_show (GTK_WIDGET (html));
@@ -2122,4 +2109,35 @@ mail_display_new (void)
return GTK_WIDGET (mail_display);
}
+void
+mail_display_initialize_gtkhtml (MailDisplay *mail_display, GtkHTML *html)
+{
+ gtk_html_set_default_content_type (GTK_HTML (html),
+ "text/html; charset=utf-8");
+
+ gtk_html_set_editable (GTK_HTML (html), FALSE);
+
+ gtk_signal_connect (GTK_OBJECT (html), "url_requested",
+ GTK_SIGNAL_FUNC (on_url_requested),
+ mail_display);
+ gtk_signal_connect (GTK_OBJECT (html), "object_requested",
+ GTK_SIGNAL_FUNC (on_object_requested),
+ mail_display);
+ gtk_signal_connect (GTK_OBJECT (html), "link_clicked",
+ GTK_SIGNAL_FUNC (on_link_clicked),
+ mail_display);
+ gtk_signal_connect (GTK_OBJECT (html), "button_press_event",
+ GTK_SIGNAL_FUNC (html_button_press_event), mail_display);
+ gtk_signal_connect (GTK_OBJECT (html), "motion_notify_event",
+ GTK_SIGNAL_FUNC (html_motion_notify_event), mail_display);
+ gtk_signal_connect (GTK_OBJECT (html), "enter_notify_event",
+ GTK_SIGNAL_FUNC (html_enter_notify_event), mail_display);
+ gtk_signal_connect (GTK_OBJECT (html), "iframe_created",
+ GTK_SIGNAL_FUNC (html_iframe_created), mail_display);
+ gtk_signal_connect (GTK_OBJECT (html), "on_url",
+ GTK_SIGNAL_FUNC (html_on_url), mail_display);
+
+}
+
+
E_MAKE_TYPE (mail_display, "MailDisplay", MailDisplay, mail_display_class_init, mail_display_init, PARENT_TYPE);
diff --git a/mail/mail-display.h b/mail/mail-display.h
index 1555405519..0d6d855105 100644
--- a/mail/mail-display.h
+++ b/mail/mail-display.h
@@ -55,17 +55,21 @@ typedef struct {
GtkType mail_display_get_type (void);
GtkWidget * mail_display_new (void);
+void mail_display_initialize_gtkhtml (MailDisplay *mail_display, GtkHTML *html);
+
void mail_display_queue_redisplay (MailDisplay *mail_display);
void mail_display_render (MailDisplay *mail_display, GtkHTML *html);
void mail_display_redisplay (MailDisplay *mail_display, gboolean unscroll);
void mail_display_redisplay_when_loaded (MailDisplay *md,
gconstpointer key,
void (*callback)(MailDisplay *, gpointer),
+ GtkHTML *html,
gpointer data);
void mail_display_stream_write_when_loaded (MailDisplay *md,
gconstpointer key,
const gchar *url,
void (*callback)(MailDisplay *, gpointer),
+ GtkHTML *html,
GtkHTMLStream *handle,
gpointer data);
@@ -82,6 +86,7 @@ void mail_display_load_images (MailDisplay *mail_display);
void mail_text_write (GtkHTML *html,
GtkHTMLStream *stream,
+ gboolean printing,
const char *text);
void mail_error_printf (GtkHTML *html,
GtkHTMLStream *stream,
diff --git a/mail/mail-format.c b/mail/mail-format.c
index 0578b76ab8..2deda8565a 100644
--- a/mail/mail-format.c
+++ b/mail/mail-format.c
@@ -211,7 +211,7 @@ mail_format_raw_message (CamelMimeMessage *mime_message, MailDisplay *md,
g_return_if_fail (CAMEL_IS_MIME_MESSAGE (mime_message));
if (!mail_content_loaded (CAMEL_DATA_WRAPPER (mime_message), md,
- TRUE, NULL, NULL))
+ TRUE, NULL, html, NULL))
return;
mail_html_write (html, stream,
@@ -653,7 +653,7 @@ attachment_header (CamelMimePart *part, const char *mime_type, MailDisplay *md,
/* Write a description, if we have one. */
info = camel_mime_part_get_description (part);
if (info) {
- htmlinfo = e_text_to_html (info, E_TEXT_TO_HTML_CONVERT_URLS);
+ htmlinfo = e_text_to_html (info, md->printing ? 0 : E_TEXT_TO_HTML_CONVERT_URLS);
gtk_html_stream_printf (stream, ", \"%s\"", htmlinfo);
g_free (htmlinfo);
}
@@ -686,7 +686,7 @@ format_mime_part (CamelMimePart *part, MailDisplay *md,
mesg = e_utf8_from_locale_string (_("Could not parse MIME message. Displaying as source."));
mail_error_printf (html, stream, "\n%s\n", mesg);
g_free (mesg);
- if (mail_content_loaded (wrapper, md, TRUE, NULL, NULL))
+ if (mail_content_loaded (wrapper, md, TRUE, NULL, html, NULL))
handle_text_plain (part, "text/plain", md, html, stream);
return TRUE;
}
@@ -722,7 +722,7 @@ format_mime_part (CamelMimePart *part, MailDisplay *md,
attachment_header (part, mime_type, md, html, stream);
if (handler && handler->builtin && inline_flags & I_DISPLAYED &&
- mail_content_loaded (wrapper, md, TRUE, NULL, NULL))
+ mail_content_loaded (wrapper, md, TRUE, NULL, html, NULL))
output = (*handler->builtin) (part, mime_type, md, html, stream);
else
output = TRUE;
@@ -780,7 +780,7 @@ static void
write_text_header (const char *name, const char *value, int flags, GtkHTML *html, GtkHTMLStream *stream)
{
char *encoded;
-
+
if (value && *value)
encoded = e_text_to_html (value, E_TEXT_TO_HTML_CONVERT_NL | E_TEXT_TO_HTML_CONVERT_URLS);
else
@@ -838,13 +838,21 @@ write_address (MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream,
}
if (have_name) {
- gtk_html_stream_printf (stream,
- "%s &lt;<a href=\"mailto:%s\">%s</a>&gt;",
- name_disp, addr_url, email_disp);
+ if (md->printing) {
+ gtk_html_stream_printf (stream, "%s &lt;%s&gt;", name_disp, email_disp);
+ } else {
+ gtk_html_stream_printf (stream,
+ "%s &lt;<a href=\"mailto:%s\">%s</a>&gt;",
+ name_disp, addr_url, email_disp);
+ }
} else {
- gtk_html_stream_printf (stream,
- "<a href=\"mailto:%s\">%s</a>",
- addr_url, email_disp);
+ if (md->printing) {
+ mail_html_write (html, stream, email_disp);
+ } else {
+ gtk_html_stream_printf (stream,
+ "<a href=\"mailto:%s\">%s</a>",
+ addr_url, email_disp);
+ }
}
} else {
@@ -1027,16 +1035,17 @@ load_offline_content (MailDisplay *md, gpointer data)
}
gboolean
-mail_content_loaded (CamelDataWrapper *wrapper, MailDisplay *md, gboolean redisplay, const gchar *url, GtkHTMLStream *handle)
+mail_content_loaded (CamelDataWrapper *wrapper, MailDisplay *md, gboolean redisplay, const gchar *url,
+ GtkHTML *html, GtkHTMLStream *handle)
{
if (!camel_data_wrapper_is_offline (wrapper))
return TRUE;
camel_object_ref (CAMEL_OBJECT (wrapper));
if (redisplay)
- mail_display_redisplay_when_loaded (md, wrapper, load_offline_content, wrapper);
+ mail_display_redisplay_when_loaded (md, wrapper, load_offline_content, html, wrapper);
else
- mail_display_stream_write_when_loaded (md, wrapper, url, load_offline_content, handle, wrapper);
+ mail_display_stream_write_when_loaded (md, wrapper, url, load_offline_content, html, handle, wrapper);
return FALSE;
}
@@ -1140,7 +1149,7 @@ struct {
#define NSPECIALS (sizeof (text_specials) / sizeof (*text_specials))
static void
-write_one_text_plain_chunk (const char *text, int len, GtkHTML *html, GtkHTMLStream *stream)
+write_one_text_plain_chunk (const char *text, int len, GtkHTML *html, GtkHTMLStream *stream, gboolean printing)
{
char *buf;
@@ -1148,7 +1157,7 @@ write_one_text_plain_chunk (const char *text, int len, GtkHTML *html, GtkHTMLStr
"<table cellspacing=0 cellpadding=10 width=\"100%\"><tr><td>\n");
buf = g_strndup (text, len);
- mail_text_write (html, stream, buf);
+ mail_text_write (html, stream, printing, buf);
g_free (buf);
mail_html_write (html, stream, "</td></tr></table>\n");
@@ -1201,7 +1210,7 @@ handle_text_plain (CamelMimePart *part, const char *mime_type,
/* Deal with special case */
if (start != p)
- write_one_text_plain_chunk (p, start - p, html, stream);
+ write_one_text_plain_chunk (p, start - p, html, stream, md->printing);
p = text_specials[i].handler (start, part, start - text, md, html, stream);
if (p == start) {
@@ -1215,13 +1224,13 @@ handle_text_plain (CamelMimePart *part, const char *mime_type,
break;
}
p++;
- write_one_text_plain_chunk (start, p - start, html, stream);
+ write_one_text_plain_chunk (start, p - start, html, stream, md->printing);
} else if (p)
write_hr (html, stream);
}
/* Finish up (or do the whole thing if there were no specials). */
if (p)
- write_one_text_plain_chunk (p, strlen (p), html, stream);
+ write_one_text_plain_chunk (p, strlen (p), html, stream, md->printing);
g_free (text);
@@ -1283,8 +1292,10 @@ handle_text_plain_flowed (char *buf, MailDisplay *md, GtkHTML *html, GtkHTMLStre
}
/* replace '<' with '&lt;', etc. */
- text = e_text_to_html (p, E_TEXT_TO_HTML_CONVERT_SPACES |
- E_TEXT_TO_HTML_CONVERT_URLS);
+ text = e_text_to_html (p,
+ md->printing ?
+ E_TEXT_TO_HTML_CONVERT_SPACES :
+ E_TEXT_TO_HTML_CONVERT_SPACES | E_TEXT_TO_HTML_CONVERT_URLS);
if (text && *text)
mail_html_write (html, stream, text);
g_free (text);
@@ -1872,7 +1883,7 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type,
if (message) {
gtk_html_stream_printf (stream, "<font size=-1 %s>", good ? "" : "color=red");
- mail_text_write (html, stream, message);
+ mail_text_write (html, stream, md->printing, message);
mail_html_write (html, stream, "</font>");
}
@@ -2203,7 +2214,7 @@ mail_get_message_rfc822 (CamelMimeMessage *message, gboolean want_plain, gboolea
cia = camel_mime_message_get_from (message);
buf = camel_address_format (CAMEL_ADDRESS (cia));
if (buf) {
- html = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL | E_TEXT_TO_HTML_CONVERT_URLS);
+ html = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL);
g_string_sprintfa (retval, "%s<b>From:</b> %s<br>",
citation, html);
g_free (html);
@@ -2213,7 +2224,7 @@ mail_get_message_rfc822 (CamelMimeMessage *message, gboolean want_plain, gboolea
cia = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO);
buf = camel_address_format (CAMEL_ADDRESS (cia));
if (buf) {
- html = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL | E_TEXT_TO_HTML_CONVERT_URLS);
+ html = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL);
g_string_sprintfa (retval, "%s<b>To:</b> %s<br>",
citation, html);
g_free (html);
@@ -2223,7 +2234,7 @@ mail_get_message_rfc822 (CamelMimeMessage *message, gboolean want_plain, gboolea
cia = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC);
buf = camel_address_format (CAMEL_ADDRESS (cia));
if (buf) {
- html = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL | E_TEXT_TO_HTML_CONVERT_URLS);
+ html = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL);
g_string_sprintfa (retval, "%s<b>Cc:</b> %s<br>",
citation, html);
g_free (html);
@@ -2240,7 +2251,7 @@ mail_get_message_rfc822 (CamelMimeMessage *message, gboolean want_plain, gboolea
date_val = camel_mime_message_get_date (message, &offset);
buf = header_format_date (date_val, offset);
- html = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL | E_TEXT_TO_HTML_CONVERT_URLS);
+ html = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL);
g_string_sprintfa (retval, "%s<b>Date:</b> %s<br>", citation, html);
g_free (html);
diff --git a/mail/mail-identify.c b/mail/mail-identify.c
index 18d25188ff..cc6e4ef9d0 100644
--- a/mail/mail-identify.c
+++ b/mail/mail-identify.c
@@ -103,7 +103,7 @@ mail_identify_mime_part (CamelMimePart *part, MailDisplay *md)
* just to identify the MIME type.
*/
if (camel_data_wrapper_is_offline (data))
- mail_content_loaded (data, md, TRUE, NULL, NULL);
+ mail_content_loaded (data, md, TRUE, NULL, NULL, NULL);
return NULL;
}
diff --git a/mail/mail-stream-gtkhtml.c b/mail/mail-stream-gtkhtml.c
index 9a7a39ac55..f7b5240f0c 100644
--- a/mail/mail-stream-gtkhtml.c
+++ b/mail/mail-stream-gtkhtml.c
@@ -94,6 +94,5 @@ stream_write (CamelStream *stream, const char *buffer, size_t n)
gtk_html_write (stream_gtkhtml->html, stream_gtkhtml->html_stream,
buffer, n);
-
return n;
}
diff --git a/mail/mail.h b/mail/mail.h
index f1a3162a66..ce240153e0 100644
--- a/mail/mail.h
+++ b/mail/mail.h
@@ -47,6 +47,7 @@ gboolean mail_content_loaded (CamelDataWrapper *wrapper,
MailDisplay *display,
gboolean redisplay,
const gchar *url,
+ GtkHTML *html,
GtkHTMLStream *handle);
typedef gboolean (*MailMimeHandlerFn) (CamelMimePart *part,