diff options
Diffstat (limited to 'em-format')
-rw-r--r-- | em-format/e-mail-formatter-error.c | 14 | ||||
-rw-r--r-- | em-format/e-mail-formatter-headers.c | 20 | ||||
-rw-r--r-- | em-format/e-mail-formatter-message-rfc822.c | 10 | ||||
-rw-r--r-- | em-format/e-mail-formatter-source.c | 29 | ||||
-rw-r--r-- | em-format/e-mail-formatter-text-enriched.c | 14 | ||||
-rw-r--r-- | em-format/e-mail-formatter-text-html.c | 8 | ||||
-rw-r--r-- | em-format/e-mail-formatter-text-plain.c | 35 | ||||
-rw-r--r-- | em-format/e-mail-formatter.c | 33 | ||||
-rw-r--r-- | em-format/e-mail-formatter.h | 2 |
9 files changed, 59 insertions, 106 deletions
diff --git a/em-format/e-mail-formatter-error.c b/em-format/e-mail-formatter-error.c index 8669c11ced..f349283021 100644 --- a/em-format/e-mail-formatter-error.c +++ b/em-format/e-mail-formatter-error.c @@ -59,24 +59,14 @@ emfe_error_format (EMailFormatterExtension *extension, dw = camel_medium_get_content (CAMEL_MEDIUM (mime_part)); html = g_strdup_printf ( - "<div class=\"part-container\" style=\"" - "border-color: #%06x;" - "background-color: #%06x; color: #%06x;\">" + "<div class=\"part-container -e-mail-formatter-frame-color " + "-e-mail-formatter-body-color -e-web-view-text-color\">" "<div class=\"part-container-inner-margin pre\">\n" "<table border=\"0\" cellspacing=\"10\" " "cellpadding=\"0\" width=\"100%%\">\n" "<tr valign=\"top\"><td width=50>" "<img src=\"gtk-stock://%s/?size=%d\" /></td>\n" "<td style=\"color: red;\">", - e_rgba_to_value ( - e_mail_formatter_get_color ( - formatter, E_MAIL_FORMATTER_COLOR_FRAME)), - e_rgba_to_value ( - e_mail_formatter_get_color ( - formatter, E_MAIL_FORMATTER_COLOR_BODY)), - e_rgba_to_value ( - e_mail_formatter_get_color ( - formatter, E_MAIL_FORMATTER_COLOR_TEXT)), GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_DIALOG); camel_stream_write_string (stream, html, cancellable, NULL); diff --git a/em-format/e-mail-formatter-headers.c b/em-format/e-mail-formatter-headers.c index e9f88704c8..3117bec265 100644 --- a/em-format/e-mail-formatter-headers.c +++ b/em-format/e-mail-formatter-headers.c @@ -490,9 +490,6 @@ emfe_headers_format (EMailFormatterExtension *extension, { CamelMimePart *mime_part; GString *buffer; - const GdkRGBA white = { 1.0, 1.0, 1.0, 1.0 }; - const GdkRGBA *body_rgba = &white; - const GdkRGBA *header_rgba; const gchar *direction; gboolean is_collapsable; gboolean is_collapsed; @@ -524,22 +521,15 @@ emfe_headers_format (EMailFormatterExtension *extension, buffer = g_string_new (""); - if (context->mode != E_MAIL_FORMATTER_MODE_PRINTING) - body_rgba = e_mail_formatter_get_color ( - formatter, E_MAIL_FORMATTER_COLOR_BODY); - - header_rgba = e_mail_formatter_get_color ( - formatter, E_MAIL_FORMATTER_COLOR_HEADER); - g_string_append_printf ( buffer, - "<div class=\"headers\" style=\"background: #%06x;\" id=\"%s\">" - "<table border=\"0\" width=\"100%%\" " - "style=\"color: #%06x; direction: %s\">" + "%s id=\"%s\"><table class=\"-e-mail-formatter-header-color\" border=\"0\" width=\"100%%\" " + "style=\"direction: %s\">" "<tr>", - e_rgba_to_value (body_rgba), + (context->mode != E_MAIL_FORMATTER_MODE_PRINTING) ? + "<div class=\"headers -e-mail-formatter-body-color\"" : + "<div class=\"headers\" style=\"background-color: #ffffff;\"", e_mail_part_get_id (part), - e_rgba_to_value (header_rgba), direction); if (is_collapsable) diff --git a/em-format/e-mail-formatter-message-rfc822.c b/em-format/e-mail-formatter-message-rfc822.c index 0477e61517..6b9f4eebb8 100644 --- a/em-format/e-mail-formatter-message-rfc822.c +++ b/em-format/e-mail-formatter-message-rfc822.c @@ -221,18 +221,12 @@ emfe_message_rfc822_format (EMailFormatterExtension *extension, NULL); str = g_strdup_printf ( - "<div class=\"part-container\" style=\"border-color: #%06x; " - "background-color: #%06x;\">\n" + "<div class=\"part-container -e-mail-formatter-frame-color " + "-e-mail-formatter-body-color\">\n" "<iframe width=\"100%%\" height=\"10\"" " id=\"%s.iframe\" " " frameborder=\"0\" src=\"%s\" name=\"%s\"></iframe>" "</div>", - e_rgba_to_value ( - e_mail_formatter_get_color ( - formatter, E_MAIL_FORMATTER_COLOR_FRAME)), - e_rgba_to_value ( - e_mail_formatter_get_color ( - formatter, E_MAIL_FORMATTER_COLOR_BODY)), part_id, uri, part_id); camel_stream_write_string (stream, str, cancellable, NULL); diff --git a/em-format/e-mail-formatter-source.c b/em-format/e-mail-formatter-source.c index 944f9a4c14..12eaa4ab7c 100644 --- a/em-format/e-mail-formatter-source.c +++ b/em-format/e-mail-formatter-source.c @@ -70,31 +70,16 @@ emfe_source_format (EMailFormatterExtension *extension, buffer = g_string_new (""); if (CAMEL_IS_MIME_MESSAGE (mime_part)) { - g_string_append_printf ( + g_string_append ( buffer, - "<div class=\"part-container\" " - "style=\"border: 0; background: #%06x; color: #%06x;\" >", - e_rgba_to_value ( - e_mail_formatter_get_color ( - formatter, E_MAIL_FORMATTER_COLOR_BODY)), - e_rgba_to_value ( - e_mail_formatter_get_color ( - formatter, E_MAIL_FORMATTER_COLOR_TEXT))); + "<div class=\"part-container -e-mail-formatter-body-color " + "-e-web-view-text-color\" style=\"border: 0;\" >"); } else { - g_string_append_printf ( + g_string_append ( buffer, - "<div class=\"part-container\" " - "style=\"border-color: #%06x; background: #%06x; color: #%06x;\">" - "<div class=\"part-container-inner-margin pre\">\n", - e_rgba_to_value ( - e_mail_formatter_get_color ( - formatter, E_MAIL_FORMATTER_COLOR_FRAME)), - e_rgba_to_value ( - e_mail_formatter_get_color ( - formatter, E_MAIL_FORMATTER_COLOR_BODY)), - e_rgba_to_value ( - e_mail_formatter_get_color ( - formatter, E_MAIL_FORMATTER_COLOR_TEXT))); + "<div class=\"part-container -e-mail-formatter-body-color " + " -e-web-view-text-color -e-mail-formatter-frame-color\">" + "<div class=\"part-container-inner-margin pre\">\n"); } camel_stream_write_string ( diff --git a/em-format/e-mail-formatter-text-enriched.c b/em-format/e-mail-formatter-text-enriched.c index 6c3b033171..168522e6b6 100644 --- a/em-format/e-mail-formatter-text-enriched.c +++ b/em-format/e-mail-formatter-text-enriched.c @@ -73,17 +73,11 @@ emfe_text_enriched_format (EMailFormatterExtension *extension, buffer = g_string_new (""); - g_string_append_printf ( + g_string_append ( buffer, - "<div class=\"part-container\" style=\"border-color: #%06x; " - "background-color: #%06x; color: #%06x;\">" - "<div class=\"part-container-inner-margin\">\n", - e_rgba_to_value ( - e_mail_formatter_get_color (formatter, E_MAIL_FORMATTER_COLOR_FRAME)), - e_rgba_to_value ( - e_mail_formatter_get_color (formatter, E_MAIL_FORMATTER_COLOR_CONTENT)), - e_rgba_to_value ( - e_mail_formatter_get_color (formatter, E_MAIL_FORMATTER_COLOR_TEXT))); + "<div class=\"part-container -e-mail-formatter-frame-color " + "-e-web-view-background-color -e-web-view-text-color\">" + "<div class=\"part-container-inner-margin\">\n"); camel_stream_write_string (stream, buffer->str, cancellable, NULL); g_string_free (buffer, TRUE); diff --git a/em-format/e-mail-formatter-text-html.c b/em-format/e-mail-formatter-text-html.c index 0a581117a6..17632fa03f 100644 --- a/em-format/e-mail-formatter-text-html.c +++ b/em-format/e-mail-formatter-text-html.c @@ -328,15 +328,13 @@ emfe_text_html_format (EMailFormatterExtension *extension, "<iframe width=\"100%%\" height=\"10\" " " frameborder=\"0\" src=\"%s\" " " id=\"%s.iframe\" name=\"%s\" " - " style=\"border: 1px solid #%06x; background-color: #ffffff;\">" + " class=\"-e-mail-formatter-frame-color\" " + " style=\"background-color: #ffffff; border: 1px solid;\">" "</iframe>" "</div>", uri, e_mail_part_get_id (part), - e_mail_part_get_id (part), - e_rgba_to_value ( - e_mail_formatter_get_color ( - formatter, E_MAIL_FORMATTER_COLOR_FRAME))); + e_mail_part_get_id (part)); camel_stream_write_string (stream, str, cancellable, NULL); diff --git a/em-format/e-mail-formatter-text-plain.c b/em-format/e-mail-formatter-text-plain.c index 638f0119a1..487dd34db0 100644 --- a/em-format/e-mail-formatter-text-plain.c +++ b/em-format/e-mail-formatter-text-plain.c @@ -70,10 +70,11 @@ emfe_text_plain_format (EMailFormatterExtension *extension, CamelDataWrapper *dw; if (context->mode == E_MAIL_FORMATTER_MODE_RAW) { - gchar *header; - header = e_mail_formatter_get_html_header (formatter); - camel_stream_write_string (stream, header, cancellable, NULL); - g_free (header); + camel_stream_write_string ( + stream, + e_mail_formatter_get_sub_html_header (formatter), + cancellable, + NULL); /* No need for body margins within <iframe> */ camel_stream_write_string ( @@ -107,16 +108,10 @@ emfe_text_plain_format (EMailFormatterExtension *extension, CAMEL_STREAM_FILTER (filtered_stream), html_filter); g_object_unref (html_filter); - content = g_strdup_printf ( - "<div class=\"part-container pre\" style=\"" - "border: none; padding: 8px; margin: 0; " - "background-color: #%06x; color: #%06x;\">\n", - e_rgba_to_value ( - e_mail_formatter_get_color ( - formatter, E_MAIL_FORMATTER_COLOR_CONTENT)), - e_rgba_to_value ( - e_mail_formatter_get_color ( - formatter, E_MAIL_FORMATTER_COLOR_TEXT))); + content = g_strdup ( + "<div class=\"part-container pre " + "-e-web-view-background-color -e-web-view-text-color\" " + "style=\"border: none; padding: 8px; margin: 0;\">"); camel_stream_write_string (stream, content, cancellable, NULL); e_mail_formatter_format_text (formatter, part, filtered_stream, cancellable); @@ -166,18 +161,14 @@ emfe_text_plain_format (EMailFormatterExtension *extension, "<iframe width=\"100%%\" height=\"10\"" " id=\"%s.iframe\" name=\"%s\" " " frameborder=\"0\" src=\"%s\" " - " style=\"border: 1px solid #%06x; background-color: #%06x;\">" + " class=\"-e-mail-formatter-frame-color" + " -e-web-view-text-color\" " + " style=\"border: 1px solid;\">" "</iframe>" "</div>", e_mail_part_get_id (part), e_mail_part_get_id (part), - uri, - e_rgba_to_value ( - e_mail_formatter_get_color ( - formatter, E_MAIL_FORMATTER_COLOR_FRAME)), - e_rgba_to_value ( - e_mail_formatter_get_color ( - formatter, E_MAIL_FORMATTER_COLOR_CONTENT))); + uri); camel_stream_write_string (stream, str, cancellable, NULL); diff --git a/em-format/e-mail-formatter.c b/em-format/e-mail-formatter.c index f3f09670d4..0cbfaf2e52 100644 --- a/em-format/e-mail-formatter.c +++ b/em-format/e-mail-formatter.c @@ -1105,10 +1105,27 @@ e_mail_formatter_format_text (EMailFormatter *formatter, g_object_unref (mime_part); } +const gchar * +e_mail_formatter_get_sub_html_header (EMailFormatter *formatter) +{ + return "<!DOCTYPE HTML>\n" + "<html>\n" + "<head>\n" + "<meta name=\"generator\" content=\"Evolution Mail\"/>\n" + "<title>Evolution Mail Display</title>\n" + "<link type=\"text/css\" rel=\"stylesheet\" " + " href=\"" STYLESHEET_URI "\"/>\n" + "<style type=\"text/css\">\n" + " table th { font-weight: bold; }\n" + "</style>\n" + "</head>" + "<body class=\"-e-web-view-background-color -e-web-view-text-color\">"; +} + gchar * e_mail_formatter_get_html_header (EMailFormatter *formatter) { - return g_strdup_printf ( + return g_strdup ( "<!DOCTYPE HTML>\n" "<html>\n" "<head>\n" @@ -1117,19 +1134,11 @@ e_mail_formatter_get_html_header (EMailFormatter *formatter) "<link type=\"text/css\" rel=\"stylesheet\" " " href=\"" STYLESHEET_URI "\"/>\n" "<style type=\"text/css\">\n" - " table th { color: #%06x; font-weight: bold; }\n" + " table th { font-weight: bold; }\n" "</style>\n" "</head>" - "<body bgcolor=\"#%06x\" text=\"#%06x\">", - e_rgba_to_value ( - e_mail_formatter_get_color ( - formatter, E_MAIL_FORMATTER_COLOR_HEADER)), - e_rgba_to_value ( - e_mail_formatter_get_color ( - formatter, E_MAIL_FORMATTER_COLOR_BODY)), - e_rgba_to_value ( - e_mail_formatter_get_color ( - formatter, E_MAIL_FORMATTER_COLOR_TEXT))); + "<body class=\"-e-mail-formatter-body-color " + "-e-web-view-background-color -e-web-view-text-color\">"); } EMailExtensionRegistry * diff --git a/em-format/e-mail-formatter.h b/em-format/e-mail-formatter.h index 9405789b72..5c9d6ff958 100644 --- a/em-format/e-mail-formatter.h +++ b/em-format/e-mail-formatter.h @@ -125,6 +125,8 @@ void e_mail_formatter_format_text (EMailFormatter *formatter, EMailPart *part, CamelStream *stream, GCancellable *cancellable); +const gchar * e_mail_formatter_get_sub_html_header + (EMailFormatter *formatter); gchar * e_mail_formatter_get_html_header (EMailFormatter *formatter); EMailExtensionRegistry * |