aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog56
-rw-r--r--mail/folder-browser-ui.c3
-rw-r--r--mail/mail-callbacks.c87
-rw-r--r--mail/mail-display.c48
-rw-r--r--mail/mail-display.h7
-rw-r--r--mail/mail-format.c318
-rw-r--r--mail/mail.h6
-rw-r--r--mail/message-list.c96
-rw-r--r--mail/message-list.etspec4
-rw-r--r--mail/message-list.h4
10 files changed, 399 insertions, 230 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index cbf4776f71..821b560f47 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,59 @@
+2001-12-11 Jon Trowbridge <trow@ximian.com>
+
+ * message-list.etspec: Add ETable magic for our new "Needs Reply"
+ column. (The next few entries are for bug #90)
+
+ * message-list.h: Add COL_NEED_REPLY.
+
+ * message-list.c: Move mail_need_reply_xpm to the end of
+ states_pixmaps.
+ (ml_duplicate_value): Handle COL_NEED_REPLY.
+ (ml_free_value): Handle COL_NEED_REPLY.
+ (ml_initialize_value): Handle COL_NEED_REPLY.
+ (ml_value_is_empty): Handle COL_NEED_REPLY. Added
+ needs_reply_map[] array.
+ (ml_value_to_string): Handle COL_NEED_REPLY.
+ (ml_tree_value_at): Fix magic numbers, undoing my changes from the
+ otehr day. Add handler for COL_NEED_REPLY.
+ (message_list_create_extras): Attach icons for COL_NEED_REPLY.
+ (on_click): Undo my previous changes to display need-reply status
+ in COL_MESSAGE_STATUS. Add handing for COL_NEED_REPLY.
+
+ * mail.h: Change mail_format_mime_message, mail_format_raw_message
+ and the MailMimeHandlerFn typedef to take GtkHTML and
+ GtkHTMLStream args, as per our changes in mail-format.c.
+
+ * mail-format.c: Giant refactoring. Remove the assumption
+ throughout that we will always want to render into the GtkHTML
+ object contained in the MailDisplay. Instead, always pass in the
+ GtkHTML and GtkHTMLStream that we want to write to. Also, ignore
+ theme work-arounds if the printing flag is set. (This and what
+ follows fixes bug #82)
+
+ * mail-display.h: Remove GtkHTMLStream *stream from MailDisplay.
+ We don't need it anymore.
+
+ * mail-display.c (mail_display_render): Added. Breaks the code
+ that renders the message into the GtkHTML object out of
+ mail_display_redisplay.
+ (mail_display_redisplay): Call mail_display_render.
+ (mail_display_init): Remove reference to ->stream.
+ (mail_display_new): Remove reference to ->stream.
+
+ * mail-callbacks.c (do_mail_print): Create a new GtkHTML to render
+ our printed version into (via the new function
+ mail_display_render. Set the MailDisplay's printing flag to TRUE
+ before we render, and set it back to FALSE afterwards.
+ (do_mail_fetch_and_print): If the preview pane isn't open when we
+ try to print, fetch the message before printing.
+ (print_msg): Call do_mail_fetch_and_print.
+ (print_preview_msg): Call do_mail_fetch_and_print.
+
+ * folder-browser-ui.c: Remove "PrintMessage" and
+ "PrintPreviewMessage" from message_pane_enables... these now work
+ when the preview pane is closed. Disable printing if multiple
+ messages are selected.
+
2001-12-10 Jeffrey Stedfast <fejj@ximian.com>
* mail-ops.c (filter_folder_filter): Don't expunge when we sync
diff --git a/mail/folder-browser-ui.c b/mail/folder-browser-ui.c
index e2b718c191..0960bd1bc4 100644
--- a/mail/folder-browser-ui.c
+++ b/mail/folder-browser-ui.c
@@ -520,7 +520,6 @@ static const char *message_pane_enables[] = {
/* these only work if there's a message in the message pane
* (preview pane). This state is independent of how many are
* selected. */
- "PrintMessage", "PrintPreviewMessage",
"ViewFullHeaders", "ViewLoadImages", "ViewNormal", "ViewSource",
"MessageSearch", "AddSenderToAddressbook",
NULL
@@ -564,6 +563,8 @@ folder_browser_ui_set_selection_state (FolderBrowser *fb, FolderBrowserSelection
"MessageReplyAll", "MessageReplyList", "MessageReplySender", "MessageResend",
"MessageForwardInline", "MessageForwardQuoted", "MessageSearch",
+ "PrintMessage", "PrintPreviewMessage",
+
"ToolsFilterMailingList", "ToolsFilterRecipient", "ToolsFilterSender",
"ToolsFilterSubject", "ToolsVFolderMailingList", "ToolsVFolderRecipient",
"ToolsVFolderSender", "ToolsVFolderSubject",
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index 494bd2a1fa..8a5429b3e6 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -2334,13 +2334,14 @@ providers_config (BonoboUIComponent *uih, void *user_data, const char *path)
static void
do_mail_print (FolderBrowser *fb, gboolean preview)
{
+ GtkHTML *html;
GnomePrintContext *print_context;
GnomePrintMaster *print_master;
GnomePrintDialog *dialog;
GnomePrinter *printer = NULL;
int copies = 1;
int collate = FALSE;
-
+
if (!preview) {
dialog = GNOME_PRINT_DIALOG (gnome_print_dialog_new (_("Print Message"),
GNOME_PRINT_DIALOG_COPIES));
@@ -2372,8 +2373,21 @@ do_mail_print (FolderBrowser *fb, gboolean preview)
gnome_print_master_set_paper (print_master, gnome_paper_with_name (_("US-Letter")));
gnome_print_master_set_copies (print_master, copies, collate);
print_context = gnome_print_master_get_context (print_master);
- gtk_html_print_set_master (fb->mail_display->html, print_master);
- gtk_html_print (fb->mail_display->html, print_context);
+
+ html = GTK_HTML (gtk_html_new ());
+
+ /* Set our 'printing' flag to true and render. This causes us
+ to ignoring any adjustments we made to accomodate the
+ user's theme. */
+ fb->mail_display->printing = TRUE;
+
+ mail_display_render (fb->mail_display, html);
+ gtk_html_print_set_master (html, print_master);
+ 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){
@@ -2394,6 +2408,69 @@ do_mail_print (FolderBrowser *fb, gboolean preview)
gtk_object_unref (GTK_OBJECT (print_master));
}
+/* This is pretty evil. FolderBrowser's API should be extended to allow these sorts of
+ things to be done in a more natural way. */
+
+/* <evil_code> */
+
+struct blarg_this_sucks {
+ FolderBrowser *fb;
+ gboolean preview;
+};
+
+static void
+done_message_selected (CamelFolder *folder, char *uid, CamelMimeMessage *msg, void *data)
+{
+ struct blarg_this_sucks *blarg = data;
+ FolderBrowser *fb = blarg->fb;
+ gboolean preview = blarg->preview;
+
+ g_free (blarg);
+
+ mail_display_set_message (fb->mail_display, (CamelMedium *)msg);
+
+ g_free (fb->loaded_uid);
+ fb->loaded_uid = fb->loading_uid;
+ fb->loading_uid = NULL;
+
+ do_mail_print (fb, preview);
+}
+
+/* Ack! Most of this is copied from folder-browser.c */
+static void
+do_mail_fetch_and_print (FolderBrowser *fb, gboolean preview)
+{
+ if (! fb->preview_shown) {
+ /* If the preview pane is closed, we have to do some
+ extra magic to load the message. */
+ struct blarg_this_sucks *blarg = g_new (struct blarg_this_sucks, 1);
+
+ blarg->fb = fb;
+ blarg->preview = preview;
+
+ fb->loading_id = 0;
+
+ /* if we are loading, then set a pending, but leave the loading, coudl cancel here (?) */
+ if (fb->loading_uid) {
+ g_free (fb->pending_uid);
+ fb->pending_uid = g_strdup (fb->new_uid);
+ } else {
+ if (fb->new_uid) {
+ fb->loading_uid = g_strdup (fb->new_uid);
+ mail_get_message (fb->folder, fb->loading_uid, done_message_selected, blarg, mail_thread_new);
+ } else {
+ mail_display_set_message (fb->mail_display, NULL);
+ g_free (blarg);
+ }
+ }
+
+ } else {
+ do_mail_print (fb, preview);
+ }
+}
+
+/* </evil_code> */
+
void
print_msg (GtkWidget *button, gpointer user_data)
{
@@ -2402,7 +2479,7 @@ print_msg (GtkWidget *button, gpointer user_data)
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- do_mail_print (fb, FALSE);
+ do_mail_fetch_and_print (fb, FALSE);
}
void
@@ -2413,7 +2490,7 @@ print_preview_msg (GtkWidget *button, gpointer user_data)
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- do_mail_print (fb, TRUE);
+ do_mail_fetch_and_print (fb, TRUE);
}
/******************** Begin Subscription Dialog ***************************/
diff --git a/mail/mail-display.c b/mail/mail-display.c
index 4746c348aa..437f4bb11e 100644
--- a/mail/mail-display.c
+++ b/mail/mail-display.c
@@ -1346,6 +1346,33 @@ clear_data (CamelObject *object, gpointer event_data, gpointer user_data)
g_datalist_clear (&data);
}
+void
+mail_display_render (MailDisplay *md, GtkHTML *html)
+{
+ GtkHTMLStream *stream;
+
+ g_return_if_fail (IS_MAIL_DISPLAY (md));
+ g_return_if_fail (GTK_IS_HTML (html));
+
+ stream = gtk_html_begin (html);
+
+ mail_html_write (html, stream,
+ "<!doctype html public \"-//W3C//DTD HTML 4.0 TRANSITIONAL//EN\">\n"
+ "<html>\n"
+ "<head>\n<meta name=\"generator\" content=\"Evolution Mail Component\">\n</head>\n");
+ mail_html_write (html, stream, "<body marginwidth=0 marginheight=0>\n");
+
+ if (md->current_message) {
+ if (md->display_style == MAIL_CONFIG_DISPLAY_SOURCE)
+ mail_format_raw_message (md->current_message, md, html, stream);
+ else
+ mail_format_mime_message (md->current_message, md, html, stream);
+ }
+
+ mail_html_write (html, stream, "</body></html>\n");
+ gtk_html_end (html, stream, GTK_HTML_STREAM_OK);
+}
+
/**
* mail_display_redisplay:
* @mail_display: the mail display object
@@ -1363,25 +1390,12 @@ mail_display_redisplay (MailDisplay *md, gboolean unscroll)
md->redisplay_counter++;
/* printf ("md %p redisplay %d\n", md, md->redisplay_counter); */
- md->stream = gtk_html_begin (GTK_HTML (md->html));
if (!unscroll) {
/* This is a hack until there's a clean way to do this. */
GTK_HTML (md->html)->engine->newPage = FALSE;
}
-
- mail_html_write (md->html, md->stream, "<!doctype html public \"-//W3C//DTD HTML 4.0 TRANSITIONAL//EN\">\n<html>\n<head>\n<meta name=\"generator\" content=\"Evolution Mail Component\">\n</head>\n");
- mail_html_write (md->html, md->stream, "<body marginwidth=0 marginheight=0>\n");
-
- if (md->current_message) {
- if (md->display_style == MAIL_CONFIG_DISPLAY_SOURCE)
- mail_format_raw_message (md->current_message, md);
- else
- mail_format_mime_message (md->current_message, md);
- }
-
- mail_html_write (md->html, md->stream, "</body></html>\n");
- gtk_html_end (md->html, md->stream, GTK_HTML_STREAM_OK);
- md->stream = NULL;
+
+ mail_display_render (md, md->html);
}
@@ -1459,7 +1473,6 @@ mail_display_init (GtkObject *object)
mail_display->scroll = NULL;
mail_display->html = NULL;
mail_display->redisplay_counter = 0;
- mail_display->stream = NULL;
mail_display->last_active = NULL;
mail_display->idle_id = 0;
mail_display->selection = NULL;
@@ -1469,6 +1482,8 @@ mail_display_init (GtkObject *object)
mail_display->invisible = gtk_invisible_new ();
mail_display->display_style = mail_config_get_message_display_style ();
+
+ mail_display->printing = FALSE;
}
static void
@@ -2100,7 +2115,6 @@ mail_display_new (void)
mail_display->scroll = E_SCROLL_FRAME (scroll);
mail_display->html = GTK_HTML (html);
- mail_display->stream = NULL;
mail_display->last_active = NULL;
mail_display->data = g_new0 (GData *, 1);
g_datalist_init (mail_display->data);
diff --git a/mail/mail-display.h b/mail/mail-display.h
index 3602fe230b..1555405519 100644
--- a/mail/mail-display.h
+++ b/mail/mail-display.h
@@ -27,11 +27,11 @@ struct _MailDisplay {
EScrollFrame *scroll;
GtkHTML *html;
- GtkHTMLStream *stream;
+ /* GtkHTMLStream *stream; */
gint redisplay_counter;
gpointer last_active;
guint idle_id;
-
+
char *charset;
char *selection;
@@ -44,6 +44,8 @@ struct _MailDisplay {
GtkWidget *invisible;
MailConfigDisplayStyle display_style;
+
+ guint printing : 1;
};
typedef struct {
@@ -54,6 +56,7 @@ GtkType mail_display_get_type (void);
GtkWidget * mail_display_new (void);
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,
diff --git a/mail/mail-format.c b/mail/mail-format.c
index 051eda7b3f..0578b76ab8 100644
--- a/mail/mail-format.c
+++ b/mail/mail-format.c
@@ -51,62 +51,64 @@
#include "mail-crypto.h"
static char *try_inline_pgp (char *start, CamelMimePart *part,
- guint offset, MailDisplay *md);
+ guint offset, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
static char *try_inline_pgp_sig (char *start, CamelMimePart *part,
- guint offset, MailDisplay *md);
+ guint offset, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
static char *try_uudecoding (char *start, CamelMimePart *part,
- guint offset, MailDisplay *md);
+ guint offset, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
static char *try_inline_binhex (char *start, CamelMimePart *part,
- guint offset, MailDisplay *md);
+ guint offset, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
static gboolean handle_text_plain (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md);
+ MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
static gboolean handle_text_plain_flowed (char *text,
- MailDisplay *md);
+ MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
static gboolean handle_text_enriched (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md);
+ MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
static gboolean handle_text_html (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md);
+ MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
static gboolean handle_image (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md);
+ MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
static gboolean handle_multipart_mixed (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md);
+ MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
static gboolean handle_multipart_related (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md);
+ MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
static gboolean handle_multipart_alternative (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md);
+ MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
static gboolean handle_multipart_appledouble (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md);
+ MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
static gboolean handle_multipart_encrypted (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md);
+ MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
static gboolean handle_multipart_signed (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md);
+ MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
static gboolean handle_message_rfc822 (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md);
+ MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
static gboolean handle_message_external_body (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md);
+ MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
static gboolean handle_via_bonobo (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md);
+ MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
/* writes the header info for a mime message into an html stream */
-static void write_headers (CamelMimeMessage *message, MailDisplay *md);
+static void write_headers (CamelMimeMessage *message, MailDisplay *md,
+ GtkHTML *html, GtkHTMLStream *stream);
/* dispatch html printing via mimetype */
-static gboolean format_mime_part (CamelMimePart *part, MailDisplay *md);
+static gboolean format_mime_part (CamelMimePart *part, MailDisplay *md,
+ GtkHTML *html, GtkHTMLStream *stream);
static void
free_url (gpointer key, gpointer value, gpointer data)
@@ -154,7 +156,8 @@ add_url (const char *kind, char *url, gpointer data, MailDisplay *md)
* Writes a CamelMimeMessage out into a MailDisplay
**/
void
-mail_format_mime_message (CamelMimeMessage *mime_message, MailDisplay *md)
+mail_format_mime_message (CamelMimeMessage *mime_message, MailDisplay *md,
+ GtkHTML *html, GtkHTMLStream *stream)
{
GHashTable *hash;
@@ -186,8 +189,8 @@ mail_format_mime_message (CamelMimeMessage *mime_message, MailDisplay *md)
(GDestroyNotify) g_hash_table_destroy);
}
- write_headers (mime_message, md);
- format_mime_part (CAMEL_MIME_PART (mime_message), md);
+ write_headers (mime_message, md, html, stream);
+ format_mime_part (CAMEL_MIME_PART (mime_message), md, html, stream);
}
@@ -199,10 +202,11 @@ mail_format_mime_message (CamelMimeMessage *mime_message, MailDisplay *md)
* Writes a CamelMimeMessage source out into a MailDisplay
**/
void
-mail_format_raw_message (CamelMimeMessage *mime_message, MailDisplay *md)
+mail_format_raw_message (CamelMimeMessage *mime_message, MailDisplay *md,
+ GtkHTML *html, GtkHTMLStream *stream)
{
GByteArray *bytes;
- char *html;
+ char *html_str;
g_return_if_fail (CAMEL_IS_MIME_MESSAGE (mime_message));
@@ -210,21 +214,21 @@ mail_format_raw_message (CamelMimeMessage *mime_message, MailDisplay *md)
TRUE, NULL, NULL))
return;
- mail_html_write (md->html, md->stream,
+ mail_html_write (html, stream,
"<table cellspacing=0 cellpadding=10 width=\"100%\"><tr><td><tt>\n");
bytes = mail_format_get_data_wrapper_text (CAMEL_DATA_WRAPPER (mime_message), md);
if (bytes) {
g_byte_array_append (bytes, "", 1);
- html = e_text_to_html (bytes->data, E_TEXT_TO_HTML_CONVERT_NL |
- E_TEXT_TO_HTML_CONVERT_SPACES | E_TEXT_TO_HTML_ESCAPE_8BIT);
+ html_str = e_text_to_html (bytes->data, E_TEXT_TO_HTML_CONVERT_NL |
+ E_TEXT_TO_HTML_CONVERT_SPACES | E_TEXT_TO_HTML_ESCAPE_8BIT);
g_byte_array_free (bytes, TRUE);
- mail_html_write (md->html, md->stream, html);
- g_free (html);
+ mail_html_write (html, stream, html_str);
+ g_free (html_str);
}
- mail_html_write (md->html, md->stream, "</tt></td></tr></table>");
+ mail_html_write (html, stream, "</tt></td></tr></table>");
}
static const char *
@@ -613,13 +617,14 @@ mail_part_set_default_displayed_inline (CamelMimePart *part, MailDisplay *md,
}
static void
-attachment_header (CamelMimePart *part, const char *mime_type, MailDisplay *md)
+attachment_header (CamelMimePart *part, const char *mime_type, MailDisplay *md,
+ GtkHTML *html, GtkHTMLStream *stream)
{
- char *htmlinfo, *html, *fmt;
+ char *htmlinfo, *html_str, *fmt;
const char *info;
/* Start the table, create the pop-up object. */
- gtk_html_stream_printf (md->stream,
+ gtk_html_stream_printf (stream,
"<table cellspacing=0 cellpadding=0>"
"<tr><td><table width=10 cellspacing=0 cellpadding=0><tr><td></td></tr></table></td>"
"<td><object classid=\"popup:%s\" type=\"%s\"></object></td>"
@@ -629,11 +634,11 @@ attachment_header (CamelMimePart *part, const char *mime_type, MailDisplay *md)
/* Write the MIME type */
info = gnome_vfs_mime_get_value (mime_type, "description");
- html = e_text_to_html (info ? info : mime_type, 0);
- htmlinfo = e_utf8_from_locale_string (html);
- g_free (html);
+ html_str = e_text_to_html (info ? info : mime_type, 0);
+ htmlinfo = e_utf8_from_locale_string (html_str);
+ g_free (html_str);
fmt = e_utf8_from_locale_string (_("%s attachment"));
- gtk_html_stream_printf (md->stream, fmt, htmlinfo);
+ gtk_html_stream_printf (stream, fmt, htmlinfo);
g_free (htmlinfo);
g_free (fmt);
@@ -641,7 +646,7 @@ attachment_header (CamelMimePart *part, const char *mime_type, MailDisplay *md)
info = camel_mime_part_get_filename (part);
if (info) {
htmlinfo = e_text_to_html (info, 0);
- gtk_html_stream_printf (md->stream, " (%s)", htmlinfo);
+ gtk_html_stream_printf (stream, " (%s)", htmlinfo);
g_free (htmlinfo);
}
@@ -649,17 +654,18 @@ attachment_header (CamelMimePart *part, const char *mime_type, MailDisplay *md)
info = camel_mime_part_get_description (part);
if (info) {
htmlinfo = e_text_to_html (info, E_TEXT_TO_HTML_CONVERT_URLS);
- gtk_html_stream_printf (md->stream, ", \"%s\"", htmlinfo);
+ gtk_html_stream_printf (stream, ", \"%s\"", htmlinfo);
g_free (htmlinfo);
}
- mail_html_write (md->html, md->stream, "</font></td></tr><tr>"
+ mail_html_write (html, stream, "</font></td></tr><tr>"
"<td height=10><table height=10 cellspacing=0 cellpadding=0>"
"<tr><td></td></tr></table></td></tr></table>\n");
}
static gboolean
-format_mime_part (CamelMimePart *part, MailDisplay *md)
+format_mime_part (CamelMimePart *part, MailDisplay *md,
+ GtkHTML *html, GtkHTMLStream *stream)
{
CamelDataWrapper *wrapper;
char *mime_type;
@@ -678,10 +684,10 @@ format_mime_part (CamelMimePart *part, MailDisplay *md)
char *mesg;
mesg = e_utf8_from_locale_string (_("Could not parse MIME message. Displaying as source."));
- mail_error_printf (md->html, md->stream, "\n%s\n", mesg);
+ mail_error_printf (html, stream, "\n%s\n", mesg);
g_free (mesg);
if (mail_content_loaded (wrapper, md, TRUE, NULL, NULL))
- handle_text_plain (part, "text/plain", md);
+ handle_text_plain (part, "text/plain", md, html, stream);
return TRUE;
}
@@ -713,11 +719,11 @@ format_mime_part (CamelMimePart *part, MailDisplay *md)
/* No header for anonymous inline parts. */
if (!((inline_flags & I_ACTUALLY) && is_anonymous (part, mime_type)))
- attachment_header (part, mime_type, 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))
- output = (*handler->builtin) (part, mime_type, md);
+ output = (*handler->builtin) (part, mime_type, md, html, stream);
else
output = TRUE;
@@ -789,7 +795,8 @@ write_text_header (const char *name, const char *value, int flags, GtkHTML *html
}
static void
-write_address (MailDisplay *md, const CamelInternetAddress *addr, const char *field_name, int flags)
+write_address (MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream,
+ const CamelInternetAddress *addr, const char *field_name, int flags)
{
const char *name, *email;
gint i;
@@ -797,7 +804,7 @@ write_address (MailDisplay *md, const CamelInternetAddress *addr, const char *fi
if (addr == NULL || !camel_internet_address_get (addr, 0, NULL, NULL))
return;
- write_field_row_begin (field_name, flags, md->html, md->stream);
+ write_field_row_begin (field_name, flags, html, stream);
i = 0;
while (camel_internet_address_get (addr, i, &name, &email)) {
@@ -823,7 +830,7 @@ write_address (MailDisplay *md, const CamelInternetAddress *addr, const char *fi
}
if (i)
- mail_html_write (md->html, md->stream, ", ");
+ mail_html_write (html, stream, ", ");
if (have_email || have_name) {
if (!have_email) {
@@ -831,11 +838,11 @@ write_address (MailDisplay *md, const CamelInternetAddress *addr, const char *fi
}
if (have_name) {
- gtk_html_stream_printf (md->stream,
+ 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 (md->stream,
+ gtk_html_stream_printf (stream,
"<a href=\"mailto:%s\">%s</a>",
addr_url, email_disp);
}
@@ -844,7 +851,7 @@ write_address (MailDisplay *md, const CamelInternetAddress *addr, const char *fi
char *str;
str = e_utf8_from_locale_string (_("Bad Address"));
- gtk_html_stream_printf (md->stream, "<i>%s</i>", str);
+ gtk_html_stream_printf (stream, "<i>%s</i>", str);
g_free (str);
}
@@ -856,7 +863,7 @@ write_address (MailDisplay *md, const CamelInternetAddress *addr, const char *fi
i++;
}
- mail_html_write (md->html, md->stream, "</td></tr>");
+ mail_html_write (html, stream, "</td></tr>");
}
/* order of these must match write_header code */
@@ -879,33 +886,40 @@ default_header_index(const char *name)
/* index is index of header in default_headers array */
static void
-write_default_header(CamelMimeMessage *message, MailDisplay *md, int index, int flags)
+write_default_header(CamelMimeMessage *message, MailDisplay *md,
+ GtkHTML *html, GtkHTMLStream *stream,
+ int index, int flags)
{
switch(index) {
case 0:
- write_address (md, camel_mime_message_get_from (message), _("From"), flags | WRITE_BOLD);
+ write_address (md, html, stream,
+ camel_mime_message_get_from (message), _("From"), flags | WRITE_BOLD);
break;
case 1:
- write_address (md, camel_mime_message_get_reply_to (message), _("Reply-To"), flags | WRITE_BOLD);
+ write_address (md, html, stream,
+ camel_mime_message_get_reply_to (message), _("Reply-To"), flags | WRITE_BOLD);
break;
case 2:
- write_address(md, camel_mime_message_get_recipients(message, CAMEL_RECIPIENT_TYPE_TO),
+ write_address(md, html, stream,
+ camel_mime_message_get_recipients(message, CAMEL_RECIPIENT_TYPE_TO),
_("To"), flags | WRITE_BOLD);
break;
case 3:
- write_address (md, camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC),
+ write_address (md, html, stream,
+ camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC),
_("Cc"), flags | WRITE_BOLD);
break;
case 4:
- write_address (md, camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_BCC),
+ write_address (md, html, stream,
+ camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_BCC),
_("Bcc"), flags | WRITE_BOLD);
break;
case 5:
write_text_header (_("Subject"), camel_mime_message_get_subject (message),
- flags | WRITE_BOLD, md->html, md->stream);
+ flags | WRITE_BOLD, html, stream);
break;
case 6:
- write_date (message, flags | WRITE_BOLD, md->html, md->stream);
+ write_date (message, flags | WRITE_BOLD, html, stream);
break;
default:
g_assert_not_reached();
@@ -915,17 +929,20 @@ write_default_header(CamelMimeMessage *message, MailDisplay *md, int index, int
#define COLOR_IS_LIGHT(r, g, b) ((r + g + b) > (128 * 3))
static void
-write_headers (CamelMimeMessage *message, MailDisplay *md)
+write_headers (CamelMimeMessage *message, MailDisplay *md,
+ GtkHTML *html, GtkHTMLStream *stream)
{
gboolean full = (md->display_style == MAIL_CONFIG_DISPLAY_FULL_HEADERS);
char bgcolor[7], fontcolor[7];
GtkStyle *style = NULL;
int i;
- /* My favorite thing to do...much around with colors so we respect people's stupid themes */
- style = gtk_widget_get_style (GTK_WIDGET (md->html));
- if (style) {
- int state = GTK_WIDGET_STATE (GTK_WIDGET (md->html));
+ /* My favorite thing to do... muck around with colors so we respect people's stupid themes.
+ However, we only do this if we are rendering to the screen -- we ignore the theme
+ when we are printing. */
+ style = gtk_widget_get_style (GTK_WIDGET (html));
+ if (style && !md->printing) {
+ int state = GTK_WIDGET_STATE (GTK_WIDGET (html));
gushort r, g, b;
r = style->base[state].red / 256;
@@ -944,7 +961,7 @@ write_headers (CamelMimeMessage *message, MailDisplay *md)
sprintf (bgcolor, "%.2X%.2X%.2X", r, g, b);
- r = style->text[state].red;
+ r = style->text[state].red / 256;
g = style->text[state].green / 256;
b = style->text[state].blue / 256;
@@ -954,7 +971,7 @@ write_headers (CamelMimeMessage *message, MailDisplay *md)
strcpy (fontcolor, "000000");
}
- gtk_html_stream_printf (md->stream,
+ gtk_html_stream_printf (stream,
"<table width=\"100%%\" cellpadding=0 cellspacing=0>"
"<tr><td colspan=3 height=10><table height=10 cellpadding=0 cellspacing=0>"
"<tr><td></td></tr></table></td></tr>"
@@ -980,18 +997,18 @@ write_headers (CamelMimeMessage *message, MailDisplay *md)
i = default_header_index(header->name);
if (i == -1) {
value = header_decode_string(header->value, charset);
- write_text_header(header->name, value, WRITE_NOCOLUMNS, md->html, md->stream);
+ write_text_header(header->name, value, WRITE_NOCOLUMNS, html, stream);
g_free(value);
} else
- write_default_header(message, md, i, WRITE_NOCOLUMNS);
+ write_default_header(message, md, html, stream, i, WRITE_NOCOLUMNS);
header = header->next;
}
} else {
for (i=0;i<sizeof(default_headers)/sizeof(default_headers[0]);i++)
- write_default_header(message, md, i, 0);
+ write_default_header(message, md, html, stream, i, 0);
}
- mail_html_write (md->html, md->stream,
+ mail_html_write (html, stream,
"</table></td></tr></table></td></tr></table></font></td>"
"<td><table width=10 cellpadding=0 cellspacing=0><tr><td>"
"</td></tr></table></td></tr></table>\n");
@@ -1099,9 +1116,9 @@ mail_format_get_data_wrapper_text (CamelDataWrapper *wrapper, MailDisplay *mail_
}
static void
-write_hr (MailDisplay *md)
+write_hr (GtkHTML *html, GtkHTMLStream *stream)
{
- mail_html_write (md->html, md->stream,
+ mail_html_write (html, stream,
"<table cellspacing=0 cellpadding=10 width=\"100%\"><tr><td width=\"100%\">"
"<hr noshadow size=1></td></tr></table>\n");
}
@@ -1113,7 +1130,7 @@ write_hr (MailDisplay *md)
struct {
char *start;
char * (*handler) (char *start, CamelMimePart *part,
- guint offset, MailDisplay *md);
+ guint offset, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
} text_specials[] = {
{ "-----BEGIN PGP MESSAGE-----\n", try_inline_pgp },
{ "-----BEGIN PGP SIGNED MESSAGE-----\n", try_inline_pgp_sig },
@@ -1123,23 +1140,23 @@ struct {
#define NSPECIALS (sizeof (text_specials) / sizeof (*text_specials))
static void
-write_one_text_plain_chunk (const char *text, int len, MailDisplay *md)
+write_one_text_plain_chunk (const char *text, int len, GtkHTML *html, GtkHTMLStream *stream)
{
char *buf;
- mail_html_write (md->html, md->stream,
+ mail_html_write (html, stream,
"<table cellspacing=0 cellpadding=10 width=\"100%\"><tr><td>\n");
buf = g_strndup (text, len);
- mail_text_write (md->html, md->stream, buf);
+ mail_text_write (html, stream, buf);
g_free (buf);
- mail_html_write (md->html, md->stream, "</td></tr></table>\n");
+ mail_html_write (html, stream, "</td></tr></table>\n");
}
static gboolean
handle_text_plain (CamelMimePart *part, const char *mime_type,
- MailDisplay *md)
+ MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
{
CamelDataWrapper *wrapper =
camel_medium_get_content_object (CAMEL_MEDIUM (part));
@@ -1162,7 +1179,7 @@ handle_text_plain (CamelMimePart *part, const char *mime_type,
type = camel_mime_part_get_content_type (part);
format = header_content_type_param (type, "format");
if (format && !g_strcasecmp (format, "flowed"))
- return handle_text_plain_flowed (text, md);
+ return handle_text_plain_flowed (text, md, html, stream);
/* Only look for binhex and stuff if this is real text/plain.
* (and not, say, application/mac-binhex40 that mail-identify
@@ -1184,9 +1201,9 @@ handle_text_plain (CamelMimePart *part, const char *mime_type,
/* Deal with special case */
if (start != p)
- write_one_text_plain_chunk (p, start - p, md);
+ write_one_text_plain_chunk (p, start - p, html, stream);
- p = text_specials[i].handler (start, part, start - text, md);
+ p = text_specials[i].handler (start, part, start - text, md, html, stream);
if (p == start) {
/* Oops. That failed. Output this line normally and
* skip over it.
@@ -1198,13 +1215,13 @@ handle_text_plain (CamelMimePart *part, const char *mime_type,
break;
}
p++;
- write_one_text_plain_chunk (start, p - start, md);
+ write_one_text_plain_chunk (start, p - start, html, stream);
} else if (p)
- write_hr (md);
+ 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), md);
+ write_one_text_plain_chunk (p, strlen (p), html, stream);
g_free (text);
@@ -1212,13 +1229,13 @@ handle_text_plain (CamelMimePart *part, const char *mime_type,
}
static gboolean
-handle_text_plain_flowed (char *buf, MailDisplay *md)
+handle_text_plain_flowed (char *buf, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
{
char *text, *line, *eol, *p;
int prevquoting = 0, quoting, len, br_pending = 0;
guint32 citation_color = mail_config_get_citation_color ();
- mail_html_write (md->html, md->stream,
+ mail_html_write (html, stream,
"\n<!-- text/plain, flowed -->\n"
"<table cellspacing=0 cellpadding=10 width=\"100%\"><tr><td>\n<tt>\n");
@@ -1233,20 +1250,20 @@ handle_text_plain_flowed (char *buf, MailDisplay *md)
quoting++;
if (quoting != prevquoting) {
if (prevquoting == 0) {
- gtk_html_stream_printf (md->stream, "<font color=\"#%06x\">", citation_color);
+ gtk_html_stream_printf (stream, "<font color=\"#%06x\">", citation_color);
if (br_pending)
br_pending--;
}
while (quoting > prevquoting) {
- mail_html_write (md->html, md->stream, "<blockquote>");
+ mail_html_write (html, stream, "<blockquote>");
prevquoting++;
}
while (quoting < prevquoting) {
- mail_html_write (md->html, md->stream, "</blockquote>");
+ mail_html_write (html, stream, "</blockquote>");
prevquoting--;
}
if (quoting == 0) {
- mail_html_write (md->html, md->stream, "</font>\n");
+ mail_html_write (html, stream, "</font>\n");
if (br_pending)
br_pending--;
}
@@ -1261,7 +1278,7 @@ handle_text_plain_flowed (char *buf, MailDisplay *md)
}
while (br_pending) {
- mail_html_write (md->html, md->stream, "<br>\n");
+ mail_html_write (html, stream, "<br>\n");
br_pending--;
}
@@ -1269,7 +1286,7 @@ handle_text_plain_flowed (char *buf, MailDisplay *md)
text = e_text_to_html (p, E_TEXT_TO_HTML_CONVERT_SPACES |
E_TEXT_TO_HTML_CONVERT_URLS);
if (text && *text)
- mail_html_write (md->html, md->stream, text);
+ mail_html_write (html, stream, text);
g_free (text);
if (p[len - 1] != ' ' || !strcmp (p, "-- "))
@@ -1280,7 +1297,7 @@ handle_text_plain_flowed (char *buf, MailDisplay *md)
}
g_free (buf);
- mail_html_write (md->html, md->stream, "</tt>\n</td></tr></table>\n");
+ mail_html_write (html, stream, "</tt>\n</td></tr></table>\n");
return TRUE;
}
@@ -1320,7 +1337,7 @@ destroy_part (CamelObject *root, gpointer event_data, gpointer user_data)
static char *
try_inline_pgp (char *start, CamelMimePart *mime_part,
- guint offset, MailDisplay *md)
+ guint offset, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
{
CamelMimePart *part;
CamelMultipart *multipart;
@@ -1358,15 +1375,15 @@ try_inline_pgp (char *start, CamelMimePart *mime_part,
camel_object_hook_event (CAMEL_OBJECT (md->current_message),
"finalize", destroy_part, part);
- write_hr (md);
- format_mime_part (part, md);
+ write_hr (html, stream);
+ format_mime_part (part, md, html, stream);
return end;
}
static char *
try_inline_pgp_sig (char *start, CamelMimePart *mime_part,
- guint offset, MailDisplay *md)
+ guint offset, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
{
CamelMimePart *part;
CamelMultipart *multipart;
@@ -1419,15 +1436,15 @@ try_inline_pgp_sig (char *start, CamelMimePart *mime_part,
camel_object_hook_event (CAMEL_OBJECT (md->current_message),
"finalize", destroy_part, part);
- write_hr (md);
- format_mime_part (part, md);
+ write_hr (html, stream);
+ format_mime_part (part, md, html, stream);
return sig_end;
}
static char *
try_uudecoding (char *start, CamelMimePart *mime_part,
- guint offset, MailDisplay *md)
+ guint offset, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
{
int mode, len, state = 0;
char *filename, *estart, *p, *out, uulen = 0;
@@ -1466,15 +1483,15 @@ try_uudecoding (char *start, CamelMimePart *mime_part,
camel_object_hook_event (CAMEL_OBJECT (md->current_message),
"finalize", destroy_part, part);
- write_hr (md);
- format_mime_part (part, md);
+ write_hr (html, stream);
+ format_mime_part (part, md, html, stream);
return p + 4;
}
static char *
try_inline_binhex (char *start, CamelMimePart *mime_part,
- guint offset, MailDisplay *md)
+ guint offset, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
{
char *p;
CamelMimePart *part;
@@ -1496,8 +1513,8 @@ try_inline_binhex (char *start, CamelMimePart *mime_part,
camel_object_hook_event (CAMEL_OBJECT (md->current_message),
"finalize", destroy_part, part);
- write_hr (md);
- format_mime_part (part, md);
+ write_hr (html, stream);
+ format_mime_part (part, md, html, stream);
return p;
}
@@ -1517,7 +1534,7 @@ g_string_append_len (GString *string, const char *str, int len)
/* text/enriched (RFC 1896) or text/richtext (included in RFC 1341) */
static gboolean
handle_text_enriched (CamelMimePart *part, const char *mime_type,
- MailDisplay *md)
+ MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
{
static GHashTable *translations = NULL;
CamelDataWrapper *wrapper =
@@ -1567,11 +1584,11 @@ handle_text_enriched (CamelMimePart *part, const char *mime_type,
if (!g_strcasecmp (mime_type, "text/richtext")) {
enriched = FALSE;
- mail_html_write (md->html, md->stream,
+ mail_html_write (html, stream,
"\n<!-- text/richtext -->\n");
} else {
enriched = TRUE;
- mail_html_write (md->html, md->stream,
+ mail_html_write (html, stream,
"\n<!-- text/enriched -->\n");
}
@@ -1665,7 +1682,7 @@ handle_text_enriched (CamelMimePart *part, const char *mime_type,
g_string_free (string, TRUE);
xed = g_strdup_printf ("x-evolution-data:%p", part);
- gtk_html_stream_printf (md->stream, "<iframe src=\"%s\" frameborder=0 scrolling=no></iframe>", xed);
+ gtk_html_stream_printf (stream, "<iframe src=\"%s\" frameborder=0 scrolling=no></iframe>", xed);
add_url ("data_urls", xed, ba, md);
return TRUE;
@@ -1673,31 +1690,31 @@ handle_text_enriched (CamelMimePart *part, const char *mime_type,
static gboolean
handle_text_html (CamelMimePart *part, const char *mime_type,
- MailDisplay *md)
+ MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
{
const char *location;
- mail_html_write (md->html, md->stream, "\n<!-- text/html -->\n");
+ mail_html_write (html, stream, "\n<!-- text/html -->\n");
/* FIXME: deal with relative URLs */
location = get_location (part, md);
if (!location)
location = get_cid (part, md);
- gtk_html_stream_printf (md->stream, "<iframe src=\"%s\" frameborder=0 scrolling=no></iframe>", location);
+ gtk_html_stream_printf (stream, "<iframe src=\"%s\" frameborder=0 scrolling=no></iframe>", location);
return TRUE;
}
static gboolean
-handle_image (CamelMimePart *part, const char *mime_type, MailDisplay *md)
+handle_image (CamelMimePart *part, const char *mime_type, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
{
- gtk_html_stream_printf (md->stream, "<img hspace=10 vspace=10 src=\"%s\">",
+ gtk_html_stream_printf (stream, "<img hspace=10 vspace=10 src=\"%s\">",
get_cid (part, md));
return TRUE;
}
static gboolean
handle_multipart_mixed (CamelMimePart *part, const char *mime_type,
- MailDisplay *md)
+ MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
{
CamelDataWrapper *wrapper =
camel_medium_get_content_object (CAMEL_MEDIUM (part));
@@ -1711,11 +1728,11 @@ handle_multipart_mixed (CamelMimePart *part, const char *mime_type,
nparts = camel_multipart_get_number (mp);
for (i = 0; i < nparts; i++) {
if (i != 0 && output)
- write_hr (md);
+ write_hr (html, stream);
part = camel_multipart_get_part (mp, i);
- output = format_mime_part (part, md);
+ output = format_mime_part (part, md, html, stream);
}
return TRUE;
@@ -1723,7 +1740,7 @@ handle_multipart_mixed (CamelMimePart *part, const char *mime_type,
static gboolean
handle_multipart_encrypted (CamelMimePart *part, const char *mime_type,
- MailDisplay *md)
+ MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
{
CamelDataWrapper *wrapper;
CamelMimePart *mime_part;
@@ -1735,7 +1752,7 @@ handle_multipart_encrypted (CamelMimePart *part, const char *mime_type,
/* Currently we only handle RFC2015-style PGP encryption. */
if (!camel_pgp_mime_is_rfc2015_encrypted (part))
- return handle_multipart_mixed (part, mime_type, md);
+ return handle_multipart_mixed (part, mime_type, md, html, stream);
camel_exception_init (&ex);
mime_part = mail_crypto_pgp_mime_part_decrypt (part, &ex);
@@ -1745,7 +1762,7 @@ handle_multipart_encrypted (CamelMimePart *part, const char *mime_type,
error = e_utf8_from_locale_string (camel_exception_get_description (&ex));
- mail_error_printf (md->html, md->stream, "\n%s\n", error);
+ mail_error_printf (html, stream, "\n%s\n", error);
g_free (error);
camel_exception_clear (&ex);
@@ -1757,13 +1774,13 @@ handle_multipart_encrypted (CamelMimePart *part, const char *mime_type,
camel_object_unref (CAMEL_OBJECT (mime_part));
/* and continue on our merry way... */
- return format_mime_part (part, md);
+ return format_mime_part (part, md, html, stream);
}
}
static gboolean
handle_multipart_signed (CamelMimePart *part, const char *mime_type,
- MailDisplay *md)
+ MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
{
CamelMimePart *subpart;
CamelDataWrapper *wrapper;
@@ -1783,11 +1800,11 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type,
nparts = camel_multipart_get_number (mp);
for (i = 0; i < nparts - 1; i++) {
if (i != 0 && output)
- write_hr (md);
+ write_hr (html, stream);
subpart = camel_multipart_get_part (mp, i);
- output = format_mime_part (subpart, md);
+ output = format_mime_part (subpart, md, html, stream);
}
subpart = camel_multipart_get_part (mp, i);
@@ -1799,7 +1816,7 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type,
/* Write out the click-for-info object */
url = g_strdup_printf ("signature:%p/%lu", subpart,
(unsigned long)time (NULL));
- gtk_html_stream_printf (md->stream,
+ gtk_html_stream_printf (stream,
"<br><table cellspacing=0 cellpadding=0>"
"<tr><td><table width=10 cellspacing=0 cellpadding=0>"
"<tr><td></td></tr></table></td>"
@@ -1809,11 +1826,11 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type,
"<td><font size=-1>", url);
add_url ("part_urls", url, subpart, md);
- mail_html_write (md->html, md->stream,
+ mail_html_write (html, stream,
U_("This message is digitally signed. "
"Click the lock icon for more information."));
- mail_html_write (md->html, md->stream,
+ mail_html_write (html, stream,
"</font></td></tr><tr><td height=10><table height=10 cellspacing=0 cellpadding=0>"
"<tr><td></td></tr></table></td></tr></table>\n");
} else {
@@ -1836,7 +1853,7 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type,
message = U_("Evolution does not recognize this type of signed message.");
if (good) {
- gtk_html_stream_printf (md->stream,
+ gtk_html_stream_printf (stream,
"<table><tr valign=top>"
"<td><img src=\"%s\"></td>"
"<td>%s<br><br>",
@@ -1844,7 +1861,7 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type,
U_("This message is digitally signed and "
"has been found to be authentic."));
} else {
- gtk_html_stream_printf (md->stream,
+ gtk_html_stream_printf (stream,
"<table><tr valign=top>"
"<td><img src=\"%s\"></td>"
"<td>%s<br><br>",
@@ -1854,13 +1871,12 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type,
}
if (message) {
- gtk_html_stream_printf (md->stream, "<font size=-1 %s>",
- good ? "" : "color=red");
- mail_text_write (md->html, md->stream, message);
- mail_html_write (md->html, md->stream, "</font>");
+ gtk_html_stream_printf (stream, "<font size=-1 %s>", good ? "" : "color=red");
+ mail_text_write (html, stream, message);
+ mail_html_write (html, stream, "</font>");
}
- mail_html_write (md->html, md->stream, "</td></tr></table>");
+ mail_html_write (html, stream, "</td></tr></table>");
camel_exception_clear (&ex);
camel_cipher_validity_free (valid);
}
@@ -1871,7 +1887,7 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type,
/* As seen in RFC 2387! */
static gboolean
handle_multipart_related (CamelMimePart *part, const char *mime_type,
- MailDisplay *md)
+ MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
{
CamelDataWrapper *wrapper =
camel_medium_get_content_object (CAMEL_MEDIUM (part));
@@ -1915,7 +1931,7 @@ handle_multipart_related (CamelMimePart *part, const char *mime_type,
if (!display_part) {
/* Oops. Hrmph. */
- return handle_multipart_mixed (part, mime_type, md);
+ return handle_multipart_mixed (part, mime_type, md, html, stream);
}
/* Record the Content-ID/Content-Location of any non-displayed parts. */
@@ -1929,7 +1945,7 @@ handle_multipart_related (CamelMimePart *part, const char *mime_type,
}
/* Now, display the displayed part. */
- return format_mime_part (display_part, md);
+ return format_mime_part (display_part, md, html, stream);
}
/* RFC 2046 says "display the last part that you are able to display". */
@@ -1960,7 +1976,7 @@ find_preferred_alternative (CamelMultipart *multipart, gboolean want_plain)
static gboolean
handle_multipart_alternative (CamelMimePart *part, const char *mime_type,
- MailDisplay *md)
+ MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
{
CamelDataWrapper *wrapper =
camel_medium_get_content_object (CAMEL_MEDIUM (part));
@@ -1973,15 +1989,15 @@ handle_multipart_alternative (CamelMimePart *part, const char *mime_type,
mime_part = find_preferred_alternative (multipart, FALSE);
if (mime_part)
- return format_mime_part (mime_part, md);
+ return format_mime_part (mime_part, md, html, stream);
else
- return handle_multipart_mixed (part, mime_type, md);
+ return handle_multipart_mixed (part, mime_type, md, html, stream);
}
/* RFC 1740 */
static gboolean
handle_multipart_appledouble (CamelMimePart *part, const char *mime_type,
- MailDisplay *md)
+ MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
{
CamelDataWrapper *wrapper =
camel_medium_get_content_object (CAMEL_MEDIUM (part));
@@ -1996,28 +2012,28 @@ handle_multipart_appledouble (CamelMimePart *part, const char *mime_type,
* likely it's application/octet-stream though.
*/
part = camel_multipart_get_part (multipart, 1);
- return format_mime_part (part, md);
+ return format_mime_part (part, md, html, stream);
}
static gboolean
handle_message_rfc822 (CamelMimePart *part, const char *mime_type,
- MailDisplay *md)
+ MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
{
CamelDataWrapper *wrapper =
camel_medium_get_content_object (CAMEL_MEDIUM (part));
g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (wrapper), FALSE);
- mail_html_write (md->html, md->stream, "<blockquote>");
- mail_format_mime_message (CAMEL_MIME_MESSAGE (wrapper), md);
- mail_html_write (md->html, md->stream, "</blockquote>");
+ mail_html_write (html, stream, "<blockquote>");
+ mail_format_mime_message (CAMEL_MIME_MESSAGE (wrapper), md, html, stream);
+ mail_html_write (html, stream, "</blockquote>");
return TRUE;
}
static gboolean
handle_message_external_body (CamelMimePart *part, const char *mime_type,
- MailDisplay *md)
+ MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
{
CamelContentType *type;
const char *access_type;
@@ -2141,9 +2157,9 @@ handle_message_external_body (CamelMimePart *part, const char *mime_type,
static gboolean
handle_via_bonobo (CamelMimePart *part, const char *mime_type,
- MailDisplay *md)
+ MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
{
- gtk_html_stream_printf (md->stream,
+ gtk_html_stream_printf (stream,
"<object classid=\"%s\" type=\"%s\"></object>",
get_cid (part, md), mime_type);
return TRUE;
diff --git a/mail/mail.h b/mail/mail.h
index 97713013c0..f1a3162a66 100644
--- a/mail/mail.h
+++ b/mail/mail.h
@@ -40,9 +40,9 @@ GByteArray *mail_format_get_data_wrapper_text (CamelDataWrapper *data,
MailDisplay *mail_display);
void mail_format_mime_message (CamelMimeMessage *mime_message,
- MailDisplay *md);
+ MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
void mail_format_raw_message (CamelMimeMessage *mime_message,
- MailDisplay *md);
+ MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
gboolean mail_content_loaded (CamelDataWrapper *wrapper,
MailDisplay *display,
gboolean redisplay,
@@ -51,7 +51,7 @@ gboolean mail_content_loaded (CamelDataWrapper *wrapper,
typedef gboolean (*MailMimeHandlerFn) (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md);
+ MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
typedef struct {
gboolean generic;
OAF_ServerInfo *component;
diff --git a/mail/message-list.c b/mail/message-list.c
index 02e6d234c9..24fac02cbe 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -138,7 +138,6 @@ static struct {
{ mail_new_xpm, NULL },
{ mail_read_xpm, NULL },
{ mail_replied_xpm, NULL },
- { mail_need_reply_xpm, NULL },
/* FIXME: Replace these with pixmaps for multiple_read and multiple_unread */
{ mail_new_xpm, NULL },
{ mail_read_xpm, NULL },
@@ -152,6 +151,7 @@ static struct {
{ score_high_xpm, NULL },
{ score_higher_xpm, NULL },
{ score_highest_xpm, NULL },
+ { mail_need_reply_xpm, NULL },
{ NULL, NULL }
};
@@ -540,6 +540,7 @@ ml_duplicate_value (ETreeModel *etm, int col, const void *value, void *data)
{
switch (col){
case COL_MESSAGE_STATUS:
+ case COL_NEED_REPLY:
case COL_FLAGGED:
case COL_SCORE:
case COL_ATTACHMENT:
@@ -566,6 +567,7 @@ ml_free_value (ETreeModel *etm, int col, void *value, void *data)
{
switch (col){
case COL_MESSAGE_STATUS:
+ case COL_NEED_REPLY:
case COL_FLAGGED:
case COL_SCORE:
case COL_ATTACHMENT:
@@ -591,6 +593,7 @@ ml_initialize_value (ETreeModel *etm, int col, void *data)
{
switch (col){
case COL_MESSAGE_STATUS:
+ case COL_NEED_REPLY:
case COL_FLAGGED:
case COL_SCORE:
case COL_ATTACHMENT:
@@ -617,6 +620,7 @@ ml_value_is_empty (ETreeModel *etm, int col, const void *value, void *data)
{
switch (col){
case COL_MESSAGE_STATUS:
+ case COL_NEED_REPLY:
case COL_FLAGGED:
case COL_SCORE:
case COL_ATTACHMENT:
@@ -645,6 +649,11 @@ static const char *status_map[] = {
N_("Multiple Messages"),
};
+static const char *needs_reply_map[] = {
+ "",
+ N_("Needs Reply"),
+};
+
static const char *score_map[] = {
N_("Lowest"),
N_("Lower"),
@@ -667,6 +676,10 @@ ml_value_to_string (ETreeModel *etm, int col, const void *value, void *data)
return g_strdup("");
return g_strdup(_(status_map[i]));
+ case COL_NEED_REPLY:
+ i = (unsigned int)value;
+ return g_strdup (_(needs_reply_map[i]));
+
case COL_SCORE:
i = (unsigned int)value + 3;
if (i > 6)
@@ -794,14 +807,12 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data)
child = e_tree_model_node_get_first_child(etm, path);
if (child && !e_tree_node_is_expanded(message_list->tree, path)) {
if (subtree_unread(message_list, child))
- return (void *)4;
+ return (void *)3;
else
- return (void *)5;
+ return (void *)4;
}
- if (msg_info->flags & CAMEL_MESSAGE_NEEDS_REPLY)
- return GINT_TO_POINTER (3);
- else if (msg_info->flags & CAMEL_MESSAGE_ANSWERED)
+ if (msg_info->flags & CAMEL_MESSAGE_ANSWERED)
return GINT_TO_POINTER (2);
else if (msg_info->flags & CAMEL_MESSAGE_SEEN)
return GINT_TO_POINTER (1);
@@ -809,6 +820,8 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data)
return GINT_TO_POINTER (0);
break;
}
+ case COL_NEED_REPLY:
+ return GINT_TO_POINTER ((msg_info->flags & CAMEL_MESSAGE_NEEDS_REPLY) != 0);
case COL_FLAGGED:
return GINT_TO_POINTER ((msg_info->flags & CAMEL_MESSAGE_FLAGGED) != 0);
case COL_SCORE: {
@@ -966,31 +979,36 @@ message_list_create_extras (void)
extras = e_table_extras_new();
e_table_extras_add_pixbuf(extras, "status", states_pixmaps [0].pixbuf);
- e_table_extras_add_pixbuf(extras, "score", states_pixmaps [14].pixbuf);
- e_table_extras_add_pixbuf(extras, "attachment", states_pixmaps [7].pixbuf);
- e_table_extras_add_pixbuf(extras, "flagged", states_pixmaps [8].pixbuf);
+ e_table_extras_add_pixbuf(extras, "score", states_pixmaps [13].pixbuf);
+ e_table_extras_add_pixbuf(extras, "attachment", states_pixmaps [6].pixbuf);
+ e_table_extras_add_pixbuf(extras, "flagged", states_pixmaps [7].pixbuf);
+ e_table_extras_add_pixbuf(extras, "needsreply", states_pixmaps [15].pixbuf);
e_table_extras_add_compare(extras, "address_compare", address_compare);
e_table_extras_add_compare(extras, "subject_compare", subject_compare);
- for (i = 0; i < 6; i++)
+ for (i = 0; i < 5; i++)
images [i] = states_pixmaps [i].pixbuf;
- e_table_extras_add_cell(extras, "render_message_status", e_cell_toggle_new (0, 6, images));
+ e_table_extras_add_cell(extras, "render_message_status", e_cell_toggle_new (0, 5, images));
for (i = 0; i < 2; i++)
- images [i] = states_pixmaps [i + 6].pixbuf;
+ images [i] = states_pixmaps [i + 5].pixbuf;
e_table_extras_add_cell(extras, "render_attachment", e_cell_toggle_new (0, 2, images));
- images [1] = states_pixmaps [8].pixbuf;
+ images [1] = states_pixmaps [7].pixbuf;
e_table_extras_add_cell(extras, "render_flagged", e_cell_toggle_new (0, 2, images));
+ images [1] = states_pixmaps [15].pixbuf;
+ e_table_extras_add_cell(extras, "render_needs_reply", e_cell_toggle_new (0, 2, images));
+
for (i = 0; i < 7; i++)
- images[i] = states_pixmaps [i + 8].pixbuf;
+ images[i] = states_pixmaps [i + 7].pixbuf;
e_table_extras_add_cell(extras, "render_score", e_cell_toggle_new (0, 7, images));
-
+
+
/* date cell */
cell = e_cell_date_new (NULL, GTK_JUSTIFY_LEFT);
gtk_object_set (GTK_OBJECT (cell),
@@ -2028,51 +2046,31 @@ on_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, Mess
int flag;
CamelMessageInfo *info;
- if (col == COL_MESSAGE_STATUS) {
- guint32 msg_flags;
-
- info = get_message_info (list, path);
- if (info == NULL) {
- return FALSE;
- }
-
- msg_flags = camel_folder_get_message_flags (list->folder, camel_message_info_uid (info));
-
- if (msg_flags & CAMEL_MESSAGE_NEEDS_REPLY) {
- flag = 0;
- } else if (msg_flags & CAMEL_MESSAGE_SEEN) {
- flag = CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_NEEDS_REPLY;
- } else {
- flag = CAMEL_MESSAGE_SEEN;
- }
-
- camel_folder_set_message_flags (list->folder, camel_message_info_uid (info),
- CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_NEEDS_REPLY, flag);
-
- if (flag & CAMEL_MESSAGE_SEEN && list->seen_id) {
- gtk_timeout_remove (list->seen_id);
- list->seen_id = 0;
- }
-
- return TRUE;
- }
-
- if (col == COL_FLAGGED)
+ if (col == COL_MESSAGE_STATUS)
+ flag = CAMEL_MESSAGE_SEEN;
+ else if (col == COL_FLAGGED)
flag = CAMEL_MESSAGE_FLAGGED;
+ else if (col == COL_NEED_REPLY)
+ flag = CAMEL_MESSAGE_NEEDS_REPLY;
else
return FALSE;
-
+
info = get_message_info (list, path);
if (info == NULL) {
return FALSE;
}
-
+
/* If a message was marked as deleted and the user flags it as important, undelete it */
- if (col == COL_FLAGGED && (info->flags & CAMEL_MESSAGE_DELETED))
+ if ((col == COL_FLAGGED || col == COL_NEED_REPLY) && (info->flags & CAMEL_MESSAGE_DELETED))
flag |= CAMEL_MESSAGE_DELETED;
camel_folder_set_message_flags (list->folder, camel_message_info_uid (info), flag, ~info->flags);
-
+
+ if (flag == CAMEL_MESSAGE_SEEN && list->seen_id) {
+ gtk_timeout_remove (list->seen_id);
+ list->seen_id = 0;
+ }
+
return TRUE;
}
diff --git a/mail/message-list.etspec b/mail/message-list.etspec
index a8bf34056a..9733eae9d6 100644
--- a/mail/message-list.etspec
+++ b/mail/message-list.etspec
@@ -1,5 +1,6 @@
<ETableSpecification cursor-mode="line" draw-grid="false" draw-focus="true" selection-mode="browse">
<ETableColumn model_col= "0" _title="Status" pixbuf="status" expansion="0.0" minimum_width="18" resizable="false" cell="render_message_status" compare="integer" sortable="false"/>
+
<ETableColumn model_col= "1" _title="Flagged" pixbuf="flagged" expansion="0.0" minimum_width="18" resizable="false" cell="render_flagged" compare="integer"/>
<ETableColumn model_col= "2" _title="Score" pixbuf="score" expansion="0.0" minimum_width="18" disabled="true" resizable="false" cell="render_score" compare="integer"/>
<ETableColumn model_col= "3" _title="Attachment" pixbuf="attachment" expansion="0.0" minimum_width="18" resizable="false" cell="render_attachment" compare="integer" sortable="false"/>
@@ -9,8 +10,9 @@
<ETableColumn model_col= "7" _title="Received" expansion="0.4" minimum_width="32" resizable="true" cell="render_date" compare="integer"/>
<ETableColumn model_col= "8" _title="To" expansion="1.0" minimum_width="32" resizable="true" cell="render_text" compare="address_compare"/>
<ETableColumn model_col= "9" _title="Size" expansion="0.2" minimum_width="32" resizable="true" cell="render_size" compare="integer"/>
+ <ETableColumn model_col="10" _title="Needs Reply" pixbuf="needsreply" expansion="0.0" minimum_width="18" resizable="false" cell="render_needs_reply" compare="integer" sortable="false"/>
<ETableState>
- <column source="0"/> <column source="3"/> <column source="1"/>
+ <column source="0"/> <column source="10"/> <column source="3"/> <column source="1"/>
<column source="4"/> <column source="5" expansion="1.60"/> <column source="6" expansion="0.40"/>
<grouping> </grouping>
</ETableState>
diff --git a/mail/message-list.h b/mail/message-list.h
index 2846c04ec4..cfed0c7e67 100644
--- a/mail/message-list.h
+++ b/mail/message-list.h
@@ -26,6 +26,7 @@ enum {
COL_RECEIVED,
COL_TO,
COL_SIZE,
+ COL_NEED_REPLY,
COL_LAST,
@@ -36,7 +37,8 @@ enum {
};
#define MESSAGE_LIST_COLUMN_IS_ACTIVE(col) (col == COL_MESSAGE_STATUS || \
- col == COL_FLAGGED)
+ col == COL_FLAGGED || \
+ col == COL_NEED_REPLY)
#define ML_HIDE_NONE_START (0)
#define ML_HIDE_NONE_END (2147483647)