From 68f27ce0c8a3ed44d1f1105970cc68326df6bad3 Mon Sep 17 00:00:00 2001 From: Tomas Popela Date: Thu, 12 Sep 2013 15:29:58 +0200 Subject: Bug #706008 - Workaround gnome-shell style change on focus change Avoid redrawing (thus loosing the selection and scroll position) of preview window on style change by defining the colors through CSS styles. On style change we just update the CSS color definitions and preview will update itself without redraw. --- em-format/e-mail-formatter-error.c | 14 ++---------- em-format/e-mail-formatter-headers.c | 20 +++++------------ em-format/e-mail-formatter-message-rfc822.c | 10 ++------- em-format/e-mail-formatter-source.c | 29 ++++++------------------ em-format/e-mail-formatter-text-enriched.c | 14 ++++-------- em-format/e-mail-formatter-text-html.c | 8 +++---- em-format/e-mail-formatter-text-plain.c | 35 +++++++++++------------------ em-format/e-mail-formatter.c | 33 +++++++++++++++++---------- em-format/e-mail-formatter.h | 2 ++ 9 files changed, 59 insertions(+), 106 deletions(-) (limited to 'em-format') 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 ( - "
" + "
" "
\n" "\n" "\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)), 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, - "
" - "" + "%s id=\"%s\">
" "", - e_rgba_to_value (body_rgba), + (context->mode != E_MAIL_FORMATTER_MODE_PRINTING) ? + "
\n" + "
\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)), 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, - "
", - 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))); + "
"); } else { - g_string_append_printf ( + g_string_append ( buffer, - "
" - "
\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))); + "
" + "
\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, - "
" - "
\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))); + "
" + "
\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, "" "
", 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 " "
", 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 "\n" + "\n" + "\n" + "\n" + "Evolution Mail Display\n" + "\n" + "\n" + "" + ""; +} + gchar * e_mail_formatter_get_html_header (EMailFormatter *formatter) { - return g_strdup_printf ( + return g_strdup ( "\n" "\n" "\n" @@ -1117,19 +1134,11 @@ e_mail_formatter_get_html_header (EMailFormatter *formatter) "\n" "\n" "" - "", - 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))); + ""); } 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 * -- cgit v1.2.3