diff options
-rw-r--r-- | composer/e-msg-composer.c | 5 | ||||
-rw-r--r-- | e-util/e-misc-utils.c | 4 | ||||
-rw-r--r-- | e-util/e-misc-utils.h | 4 | ||||
-rw-r--r-- | em-format/e-mail-formatter-error.c | 6 | ||||
-rw-r--r-- | em-format/e-mail-formatter-headers.c | 8 | ||||
-rw-r--r-- | em-format/e-mail-formatter-message-rfc822.c | 4 | ||||
-rw-r--r-- | em-format/e-mail-formatter-print.c | 13 | ||||
-rw-r--r-- | em-format/e-mail-formatter-source.c | 10 | ||||
-rw-r--r-- | em-format/e-mail-formatter-text-enriched.c | 6 | ||||
-rw-r--r-- | em-format/e-mail-formatter-text-html.c | 4 | ||||
-rw-r--r-- | em-format/e-mail-formatter-text-plain.c | 10 | ||||
-rw-r--r-- | em-format/e-mail-formatter.c | 106 | ||||
-rw-r--r-- | em-format/e-mail-formatter.h | 16 | ||||
-rw-r--r-- | mail/e-mail-display.c | 21 | ||||
-rw-r--r-- | mail/em-utils.c | 5 | ||||
-rw-r--r-- | modules/mail/em-mailer-prefs.c | 40 | ||||
-rw-r--r-- | modules/settings/e-settings-mail-formatter.c | 14 | ||||
-rw-r--r-- | modules/text-highlight/e-mail-formatter-text-highlight.c | 4 |
18 files changed, 137 insertions, 143 deletions
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 76aa82eacb..78419b7d14 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -218,10 +218,9 @@ emcu_part_to_html (EMsgComposer *composer, formatter = e_mail_formatter_quote_new ( NULL, E_MAIL_FORMATTER_QUOTE_FLAG_KEEP_SIG); - e_mail_formatter_set_style ( + e_mail_formatter_update_style ( formatter, - gtk_widget_get_style (GTK_WIDGET (window)), - gtk_widget_get_state (GTK_WIDGET (window))); + gtk_widget_get_state_flags (GTK_WIDGET (window))); e_mail_formatter_format_sync ( formatter, part_list, (CamelStream *) mem, diff --git a/e-util/e-misc-utils.c b/e-util/e-misc-utils.c index 97e5c2d37e..59e6e67eb2 100644 --- a/e-util/e-misc-utils.c +++ b/e-util/e-misc-utils.c @@ -1149,7 +1149,7 @@ e_int_compare (gconstpointer x, * Returns: a 24-bit color value **/ guint32 -e_color_to_value (GdkColor *color) +e_color_to_value (const GdkColor *color) { GdkRGBA rgba; @@ -1173,7 +1173,7 @@ e_color_to_value (GdkColor *color) * Returns: a 24-bit color value **/ guint32 -e_rgba_to_value (GdkRGBA *rgba) +e_rgba_to_value (const GdkRGBA *rgba) { guint16 red; guint16 green; diff --git a/e-util/e-misc-utils.h b/e-util/e-misc-utils.h index d7dea7afc3..1493d12d65 100644 --- a/e-util/e-misc-utils.h +++ b/e-util/e-misc-utils.h @@ -108,9 +108,9 @@ gint e_collate_compare (gconstpointer x, gconstpointer y); gint e_int_compare (gconstpointer x, gconstpointer y); -guint32 e_color_to_value (GdkColor *color); +guint32 e_color_to_value (const GdkColor *color); -guint32 e_rgba_to_value (GdkRGBA *rgba); +guint32 e_rgba_to_value (const GdkRGBA *rgba); /* This only makes a filename safe for usage as a filename. * It still may have shell meta-characters in it. */ diff --git a/em-format/e-mail-formatter-error.c b/em-format/e-mail-formatter-error.c index 6decb6409b..d5fd64b50d 100644 --- a/em-format/e-mail-formatter-error.c +++ b/em-format/e-mail-formatter-error.c @@ -66,13 +66,13 @@ emfe_error_format (EMailFormatterExtension *extension, "<tr valign=\"top\"><td width=50>" "<img src=\"gtk-stock://%s/?size=%d\" /></td>\n" "<td style=\"color: red;\">", - e_color_to_value ((GdkColor *) + e_rgba_to_value ( e_mail_formatter_get_color ( formatter, E_MAIL_FORMATTER_COLOR_FRAME)), - e_color_to_value ((GdkColor *) + e_rgba_to_value ( e_mail_formatter_get_color ( formatter, E_MAIL_FORMATTER_COLOR_BODY)), - e_color_to_value ((GdkColor *) + e_rgba_to_value ( e_mail_formatter_get_color ( formatter, E_MAIL_FORMATTER_COLOR_TEXT)), GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_DIALOG); diff --git a/em-format/e-mail-formatter-headers.c b/em-format/e-mail-formatter-headers.c index ef86c21fc5..ab22e1a353 100644 --- a/em-format/e-mail-formatter-headers.c +++ b/em-format/e-mail-formatter-headers.c @@ -516,10 +516,10 @@ emfe_headers_format (EMailFormatterExtension *extension, buffer = g_string_new (""); if (context->mode == E_MAIL_FORMATTER_MODE_PRINTING) { - GdkColor white = { 0, G_MAXUINT16, G_MAXUINT16, G_MAXUINT16 }; - bg_color = e_color_to_value (&white); + GdkRGBA white = { 1.0, 1.0, 1.0, 1.0}; + bg_color = e_rgba_to_value (&white); } else { - bg_color = e_color_to_value ((GdkColor *) + bg_color = e_rgba_to_value ( e_mail_formatter_get_color ( formatter, E_MAIL_FORMATTER_COLOR_BODY)); } @@ -531,7 +531,7 @@ emfe_headers_format (EMailFormatterExtension *extension, "<tr><td valign=\"top\" width=\"16\">\n", bg_color, part->id, - e_color_to_value ((GdkColor *) + e_rgba_to_value ( e_mail_formatter_get_color ( formatter, E_MAIL_FORMATTER_COLOR_HEADER))); diff --git a/em-format/e-mail-formatter-message-rfc822.c b/em-format/e-mail-formatter-message-rfc822.c index f6e1a18cfc..8059e55e76 100644 --- a/em-format/e-mail-formatter-message-rfc822.c +++ b/em-format/e-mail-formatter-message-rfc822.c @@ -217,10 +217,10 @@ emfe_message_rfc822_format (EMailFormatterExtension *extension, " id=\"%s.iframe\" " " frameborder=\"0\" src=\"%s\" name=\"%s\"></iframe>" "</div>", - e_color_to_value ((GdkColor *) + e_rgba_to_value ( e_mail_formatter_get_color ( formatter, E_MAIL_FORMATTER_COLOR_FRAME)), - e_color_to_value ((GdkColor *) + e_rgba_to_value ( e_mail_formatter_get_color ( formatter, E_MAIL_FORMATTER_COLOR_BODY)), part->id, uri, part->id); diff --git a/em-format/e-mail-formatter-print.c b/em-format/e-mail-formatter-print.c index 7e15b93e0f..4d6487d526 100644 --- a/em-format/e-mail-formatter-print.c +++ b/em-format/e-mail-formatter-print.c @@ -175,22 +175,21 @@ mail_formatter_print_run (EMailFormatter *formatter, } static void -mail_formatter_set_style (EMailFormatter *formatter, - GtkStyle *style, - GtkStateType state) +mail_formatter_update_style (EMailFormatter *formatter, + GtkStateFlags state) { EMailFormatterClass *formatter_class; /* White background */ - GdkColor body_color = { 0, G_MAXUINT16, G_MAXUINT16, G_MAXUINT16 }; + GdkRGBA body_color = { 1.0, 1.0, 1.0, 1.0 }; /* Black text */ - GdkColor text_color = { 0, 0, 0, 0 }; + GdkRGBA text_color = { 0.0, 0.0, 0.0, 0.0 }; g_object_freeze_notify (G_OBJECT (formatter)); /* Set the other colors */ formatter_class = E_MAIL_FORMATTER_CLASS (e_mail_formatter_print_parent_class); - formatter_class->set_style (formatter, style, state); + formatter_class->update_style (formatter, state); e_mail_formatter_set_color ( formatter, E_MAIL_FORMATTER_COLOR_FRAME, &body_color); @@ -225,7 +224,7 @@ e_mail_formatter_print_class_init (EMailFormatterPrintClass *class) formatter_class = E_MAIL_FORMATTER_CLASS (class); formatter_class->run = mail_formatter_print_run; - formatter_class->set_style = mail_formatter_set_style; + formatter_class->update_style = mail_formatter_update_style; object_class = G_OBJECT_CLASS (class); object_class->finalize = e_mail_formatter_print_finalize; diff --git a/em-format/e-mail-formatter-source.c b/em-format/e-mail-formatter-source.c index fed444e0f1..faa4c76521 100644 --- a/em-format/e-mail-formatter-source.c +++ b/em-format/e-mail-formatter-source.c @@ -72,10 +72,10 @@ emfe_source_format (EMailFormatterExtension *extension, buffer, "<div class=\"part-container\" " "style=\"border: 0; background: #%06x; color: #%06x;\" >", - e_color_to_value ((GdkColor *) + e_rgba_to_value ( e_mail_formatter_get_color ( formatter, E_MAIL_FORMATTER_COLOR_BODY)), - e_color_to_value ((GdkColor *) + e_rgba_to_value ( e_mail_formatter_get_color ( formatter, E_MAIL_FORMATTER_COLOR_TEXT))); } else { @@ -84,13 +84,13 @@ emfe_source_format (EMailFormatterExtension *extension, "<div class=\"part-container\" " "style=\"border-color: #%06x; background: #%06x; color: #%06x;\">" "<div class=\"part-container-inner-margin pre\">\n", - e_color_to_value ((GdkColor *) + e_rgba_to_value ( e_mail_formatter_get_color ( formatter, E_MAIL_FORMATTER_COLOR_FRAME)), - e_color_to_value ((GdkColor *) + e_rgba_to_value ( e_mail_formatter_get_color ( formatter, E_MAIL_FORMATTER_COLOR_BODY)), - e_color_to_value ((GdkColor *) + e_rgba_to_value ( e_mail_formatter_get_color ( formatter, E_MAIL_FORMATTER_COLOR_TEXT))); } diff --git a/em-format/e-mail-formatter-text-enriched.c b/em-format/e-mail-formatter-text-enriched.c index 988579e7cd..3859558aaf 100644 --- a/em-format/e-mail-formatter-text-enriched.c +++ b/em-format/e-mail-formatter-text-enriched.c @@ -76,11 +76,11 @@ emfe_text_enriched_format (EMailFormatterExtension *extension, "<div class=\"part-container\" style=\"border-color: #%06x; " "background-color: #%06x; color: #%06x;\">" "<div class=\"part-container-inner-margin\">\n", - e_color_to_value ((GdkColor *) + e_rgba_to_value ( e_mail_formatter_get_color (formatter, E_MAIL_FORMATTER_COLOR_FRAME)), - e_color_to_value ((GdkColor *) + e_rgba_to_value ( e_mail_formatter_get_color (formatter, E_MAIL_FORMATTER_COLOR_CONTENT)), - e_color_to_value ((GdkColor *) + e_rgba_to_value ( e_mail_formatter_get_color (formatter, E_MAIL_FORMATTER_COLOR_TEXT))); camel_stream_write_string (stream, buffer->str, cancellable, NULL); diff --git a/em-format/e-mail-formatter-text-html.c b/em-format/e-mail-formatter-text-html.c index 8e9a6a6d0e..2b8eb567ee 100644 --- a/em-format/e-mail-formatter-text-html.c +++ b/em-format/e-mail-formatter-text-html.c @@ -331,10 +331,10 @@ emfe_text_html_format (EMailFormatterExtension *extension, uri, part->id, part->id, - e_color_to_value ((GdkColor *) + e_rgba_to_value ( e_mail_formatter_get_color ( formatter, E_MAIL_FORMATTER_COLOR_FRAME)), - e_color_to_value ((GdkColor *) + e_rgba_to_value ( e_mail_formatter_get_color ( formatter, E_MAIL_FORMATTER_COLOR_CONTENT))); diff --git a/em-format/e-mail-formatter-text-plain.c b/em-format/e-mail-formatter-text-plain.c index bf83e166dd..122c566cf0 100644 --- a/em-format/e-mail-formatter-text-plain.c +++ b/em-format/e-mail-formatter-text-plain.c @@ -93,7 +93,7 @@ emfe_text_plain_format (EMailFormatterExtension *extension, && !g_ascii_strcasecmp (format, "flowed")) flags |= CAMEL_MIME_FILTER_TOHTML_FORMAT_FLOWED; - rgb = e_color_to_value ((GdkColor *) + rgb = e_rgba_to_value ( e_mail_formatter_get_color ( formatter, E_MAIL_FORMATTER_COLOR_CITATION)); @@ -107,10 +107,10 @@ emfe_text_plain_format (EMailFormatterExtension *extension, "<div class=\"part-container pre\" style=\"" "border: none; padding: 8px; margin: 0; " "background-color: #%06x; color: #%06x;\">\n", - e_color_to_value ((GdkColor *) + e_rgba_to_value ( e_mail_formatter_get_color ( formatter, E_MAIL_FORMATTER_COLOR_CONTENT)), - e_color_to_value ((GdkColor *) + e_rgba_to_value ( e_mail_formatter_get_color ( formatter, E_MAIL_FORMATTER_COLOR_TEXT))); @@ -164,10 +164,10 @@ emfe_text_plain_format (EMailFormatterExtension *extension, "</iframe>" "</div>", part->id, part->id, uri, - e_color_to_value ((GdkColor *) + e_rgba_to_value ( e_mail_formatter_get_color ( formatter, E_MAIL_FORMATTER_COLOR_FRAME)), - e_color_to_value ((GdkColor *) + e_rgba_to_value ( e_mail_formatter_get_color ( formatter, E_MAIL_FORMATTER_COLOR_CONTENT))); diff --git a/em-format/e-mail-formatter.c b/em-format/e-mail-formatter.c index ad62320eee..95eacaaed7 100644 --- a/em-format/e-mail-formatter.c +++ b/em-format/e-mail-formatter.c @@ -466,34 +466,42 @@ mail_formatter_run (EMailFormatter *formatter, } static void -mail_formatter_set_style (EMailFormatter *formatter, - GtkStyle *style, - GtkStateType state) +mail_formatter_update_style (EMailFormatter *formatter, + GtkStateFlags state) { - GdkColor *color; - EMailFormatterColorType type; + GtkStyleContext *style_context; + GtkWidgetPath *widget_path; + GdkRGBA rgba; g_object_freeze_notify (G_OBJECT (formatter)); - color = &style->bg[state]; - type = E_MAIL_FORMATTER_COLOR_BODY; - e_mail_formatter_set_color (formatter, type, color); + /* derive colors from top-level window */ + style_context = gtk_style_context_new (); + widget_path = gtk_widget_path_new (); + gtk_widget_path_append_type (widget_path, GTK_TYPE_WINDOW); + gtk_style_context_set_path (style_context, widget_path); - color = &style->base[GTK_STATE_NORMAL]; - type = E_MAIL_FORMATTER_COLOR_CONTENT; - e_mail_formatter_set_color (formatter, type, color); + gtk_style_context_get_background_color (style_context, state, &rgba); + e_mail_formatter_set_color (formatter, E_MAIL_FORMATTER_COLOR_BODY, &rgba); - color = &style->dark[state]; - type = E_MAIL_FORMATTER_COLOR_FRAME; - e_mail_formatter_set_color (formatter, type, color); + rgba.red *= 0.8; + rgba.green *= 0.8; + rgba.blue *= 0.8; + e_mail_formatter_set_color (formatter, E_MAIL_FORMATTER_COLOR_FRAME, &rgba); - color = &style->fg[state]; - type = E_MAIL_FORMATTER_COLOR_HEADER; - e_mail_formatter_set_color (formatter, type, color); + gtk_style_context_get_color (style_context, state, &rgba); + e_mail_formatter_set_color (formatter, E_MAIL_FORMATTER_COLOR_HEADER, &rgba); - color = &style->text[state]; - type = E_MAIL_FORMATTER_COLOR_TEXT; - e_mail_formatter_set_color (formatter, type, color); + gtk_style_context_add_class (style_context, GTK_STYLE_CLASS_ENTRY); + + gtk_style_context_get_background_color (style_context, state | GTK_STATE_FLAG_FOCUSED, &rgba); + e_mail_formatter_set_color (formatter, E_MAIL_FORMATTER_COLOR_CONTENT, &rgba); + + gtk_style_context_get_color (style_context, state | GTK_STATE_FLAG_FOCUSED, &rgba); + e_mail_formatter_set_color (formatter, E_MAIL_FORMATTER_COLOR_TEXT, &rgba); + + gtk_widget_path_free (widget_path); + g_object_unref (style_context); g_object_thaw_notify (G_OBJECT (formatter)); } @@ -542,7 +550,7 @@ static void e_mail_formatter_class_init (EMailFormatterClass *class) { GObjectClass *object_class; - GdkColor *color; + GdkRGBA *rgba; e_mail_formatter_parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EMailFormatterPrivate)); @@ -555,22 +563,22 @@ e_mail_formatter_class_init (EMailFormatterClass *class) class->context_size = sizeof (EMailFormatterContext); class->run = mail_formatter_run; - class->set_style = mail_formatter_set_style; + class->update_style = mail_formatter_update_style; - color = &class->colors[E_MAIL_FORMATTER_COLOR_BODY]; - gdk_color_parse ("#eeeeee", color); + rgba = &class->colors[E_MAIL_FORMATTER_COLOR_BODY]; + gdk_rgba_parse (rgba, "#eeeeee"); - color = &class->colors[E_MAIL_FORMATTER_COLOR_CONTENT]; - gdk_color_parse ("#ffffff", color); + rgba = &class->colors[E_MAIL_FORMATTER_COLOR_CONTENT]; + gdk_rgba_parse (rgba, "#ffffff"); - color = &class->colors[E_MAIL_FORMATTER_COLOR_FRAME]; - gdk_color_parse ("#3f3f3f", color); + rgba = &class->colors[E_MAIL_FORMATTER_COLOR_FRAME]; + gdk_rgba_parse (rgba, "#3f3f3f"); - color = &class->colors[E_MAIL_FORMATTER_COLOR_HEADER]; - gdk_color_parse ("#eeeeee", color); + rgba = &class->colors[E_MAIL_FORMATTER_COLOR_HEADER]; + gdk_rgba_parse (rgba, "#eeeeee"); - color = &class->colors[E_MAIL_FORMATTER_COLOR_TEXT]; - gdk_color_parse ("#000000", color); + rgba = &class->colors[E_MAIL_FORMATTER_COLOR_TEXT]; + gdk_rgba_parse (rgba, "#000000"); g_object_class_install_property ( object_class, @@ -579,7 +587,7 @@ e_mail_formatter_class_init (EMailFormatterClass *class) "body-color", "Body Color", NULL, - GDK_TYPE_COLOR, + GDK_TYPE_RGBA, G_PARAM_READWRITE)); g_object_class_install_property ( @@ -589,7 +597,7 @@ e_mail_formatter_class_init (EMailFormatterClass *class) "citation-color", "Citation Color", NULL, - GDK_TYPE_COLOR, + GDK_TYPE_RGBA, G_PARAM_READWRITE)); g_object_class_install_property ( @@ -599,7 +607,7 @@ e_mail_formatter_class_init (EMailFormatterClass *class) "content-color", "Content Color", NULL, - GDK_TYPE_COLOR, + GDK_TYPE_RGBA, G_PARAM_READWRITE)); g_object_class_install_property ( @@ -609,7 +617,7 @@ e_mail_formatter_class_init (EMailFormatterClass *class) "frame-color", "Frame Color", NULL, - GDK_TYPE_COLOR, + GDK_TYPE_RGBA, G_PARAM_READWRITE)); g_object_class_install_property ( @@ -619,7 +627,7 @@ e_mail_formatter_class_init (EMailFormatterClass *class) "header-color", "Header Color", NULL, - GDK_TYPE_COLOR, + GDK_TYPE_RGBA, G_PARAM_READWRITE)); g_object_class_install_property ( @@ -1067,13 +1075,13 @@ e_mail_formatter_get_html_header (EMailFormatter *formatter) " table th { color: #%06x; font-weight: bold; }\n" "</style>\n" "</head><body bgcolor=\"#%06x\" text=\"#%06x\">", - e_color_to_value ((GdkColor *) + e_rgba_to_value ( e_mail_formatter_get_color ( formatter, E_MAIL_FORMATTER_COLOR_HEADER)), - e_color_to_value ((GdkColor *) + e_rgba_to_value ( e_mail_formatter_get_color ( formatter, E_MAIL_FORMATTER_COLOR_BODY)), - e_color_to_value ((GdkColor *) + e_rgba_to_value ( e_mail_formatter_get_color ( formatter, E_MAIL_FORMATTER_COLOR_TEXT))); } @@ -1097,7 +1105,7 @@ e_mail_formatter_get_text_format_flags (EMailFormatter *formatter) return E_MAIL_FORMATTER_GET_CLASS (formatter)->text_html_flags; } -const GdkColor * +const GdkRGBA * e_mail_formatter_get_color (EMailFormatter *formatter, EMailFormatterColorType type) { @@ -1110,9 +1118,9 @@ e_mail_formatter_get_color (EMailFormatter *formatter, void e_mail_formatter_set_color (EMailFormatter *formatter, EMailFormatterColorType type, - const GdkColor *color) + const GdkRGBA *color) { - GdkColor *format_color; + GdkRGBA *format_color; const gchar *property_name; g_return_if_fail (E_IS_MAIL_FORMATTER (formatter)); @@ -1121,7 +1129,7 @@ e_mail_formatter_set_color (EMailFormatter *formatter, format_color = &E_MAIL_FORMATTER_GET_CLASS (formatter)->colors[type]; - if (gdk_color_equal (color, format_color)) + if (gdk_rgba_equal (color, format_color)) return; format_color->red = color->red; @@ -1155,19 +1163,17 @@ e_mail_formatter_set_color (EMailFormatter *formatter, } void -e_mail_formatter_set_style (EMailFormatter *formatter, - GtkStyle *style, - GtkStateType state) +e_mail_formatter_update_style (EMailFormatter *formatter, + GtkStateFlags state) { EMailFormatterClass *formatter_class; g_return_if_fail (E_IS_MAIL_FORMATTER (formatter)); - g_return_if_fail (GTK_IS_STYLE (style)); formatter_class = E_MAIL_FORMATTER_GET_CLASS (formatter); - g_return_if_fail (formatter_class->set_style != NULL); + g_return_if_fail (formatter_class->update_style != NULL); - formatter_class->set_style (formatter, style, state); + formatter_class->update_style (formatter, state); } EMailImageLoadingPolicy diff --git a/em-format/e-mail-formatter.h b/em-format/e-mail-formatter.h index 93e5268950..2c7b144359 100644 --- a/em-format/e-mail-formatter.h +++ b/em-format/e-mail-formatter.h @@ -110,7 +110,7 @@ struct _EMailFormatterClass { CamelMimeFilterToHTMLFlags text_html_flags; /* Colors should apply globally */ - GdkColor colors[E_MAIL_FORMATTER_NUM_COLOR_TYPES]; + GdkRGBA colors[E_MAIL_FORMATTER_NUM_COLOR_TYPES]; /* sizeof(EMailFormatterContext) or some derivative struct */ gsize context_size; @@ -120,9 +120,8 @@ struct _EMailFormatterClass { CamelStream *stream, GCancellable *cancellable); - void (*set_style) (EMailFormatter *formatter, - GtkStyle *style, - GtkStateType state); + void (*update_style) (EMailFormatter *formatter, + GtkStateFlags state); /* Signals */ void (*need_redraw) (EMailFormatter *formatter); @@ -175,15 +174,14 @@ CamelMimeFilterToHTMLFlags e_mail_formatter_get_text_format_flags (EMailFormatter *formatter); -const GdkColor * +const GdkRGBA * e_mail_formatter_get_color (EMailFormatter *formatter, EMailFormatterColorType type); void e_mail_formatter_set_color (EMailFormatter *efh, EMailFormatterColorType type, - const GdkColor *color); -void e_mail_formatter_set_style (EMailFormatter *formatter, - GtkStyle *style, - GtkStateType state); + const GdkRGBA *color); +void e_mail_formatter_update_style (EMailFormatter *formatter, + GtkStateFlags state); EMailImageLoadingPolicy e_mail_formatter_get_image_loading_policy diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c index 6794b144a4..7f6063b07d 100644 --- a/mail/e-mail-display.c +++ b/mail/e-mail-display.c @@ -195,15 +195,11 @@ mail_display_image_exists_in_cache (const gchar *image_uri) static void mail_display_update_formatter_colors (EMailDisplay *display) { - GtkStyle *style; - GtkStateType state; - if (display->priv->formatter == NULL) return; - style = gtk_widget_get_style (GTK_WIDGET (display)); - state = gtk_widget_get_state (GTK_WIDGET (display)); - e_mail_formatter_set_style (display->priv->formatter, style, state); + e_mail_formatter_update_style (display->priv->formatter, + gtk_widget_get_state_flags (GTK_WIDGET (display))); } static void @@ -1371,16 +1367,15 @@ mail_display_realize (GtkWidget *widget) } static void -mail_display_style_set (GtkWidget *widget, - GtkStyle *previous_style) +mail_display_style_updated (GtkWidget *widget) { EMailDisplay *display = E_MAIL_DISPLAY (widget); mail_display_update_formatter_colors (display); - /* Chain up to parent's style_set() method. */ + /* Chain up to parent's style_updated() method. */ GTK_WIDGET_CLASS (e_mail_display_parent_class)-> - style_set (widget, previous_style); + style_updated (widget); } static gboolean @@ -1490,7 +1485,7 @@ e_mail_display_class_init (EMailDisplayClass *class) widget_class = GTK_WIDGET_CLASS (class); widget_class->realize = mail_display_realize; - widget_class->style_set = mail_display_style_set; + widget_class->style_updated = mail_display_style_updated; widget_class->button_press_event = mail_display_button_press_event; web_view_class = E_WEB_VIEW_CLASS (class); @@ -1971,11 +1966,11 @@ e_mail_display_set_status (EMailDisplay *display, " </table>\n" "</body>\n" "</html>\n", - e_color_to_value ((GdkColor *) + e_rgba_to_value ( e_mail_formatter_get_color ( display->priv->formatter, E_MAIL_FORMATTER_COLOR_CONTENT)), - e_color_to_value ((GdkColor *) + e_rgba_to_value ( e_mail_formatter_get_color ( display->priv->formatter, E_MAIL_FORMATTER_COLOR_TEXT)), diff --git a/mail/em-utils.c b/mail/em-utils.c index 0da08fa324..052af8c5ae 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -1284,9 +1284,8 @@ em_utils_message_to_html (CamelSession *session, camel_stream_mem_set_byte_array (CAMEL_STREAM_MEM (mem), buf); formatter = e_mail_formatter_quote_new (credits, flags); - e_mail_formatter_set_style (formatter, - gtk_widget_get_style (GTK_WIDGET (window)), - gtk_widget_get_state (GTK_WIDGET (window))); + e_mail_formatter_update_style (formatter, + gtk_widget_get_state_flags (GTK_WIDGET (window))); if (parts_list == NULL) { GSettings *settings; diff --git a/modules/mail/em-mailer-prefs.c b/modules/mail/em-mailer-prefs.c index fc3e3c4e66..3eedb6a816 100644 --- a/modules/mail/em-mailer-prefs.c +++ b/modules/mail/em-mailer-prefs.c @@ -146,17 +146,17 @@ mailer_prefs_map_seconds_to_milliseconds (const GValue *value, } static gboolean -mailer_prefs_map_string_to_color (GValue *value, - GVariant *variant, - gpointer user_data) +mailer_prefs_map_string_to_rgba (GValue *value, + GVariant *variant, + gpointer user_data) { - GdkColor color; + GdkRGBA rgba; const gchar *string; gboolean success = FALSE; string = g_variant_get_string (variant, NULL); - if (gdk_color_parse (string, &color)) { - g_value_set_boxed (value, &color); + if (gdk_rgba_parse (&rgba, string)) { + g_value_set_boxed (value, &rgba); success = TRUE; } @@ -164,27 +164,25 @@ mailer_prefs_map_string_to_color (GValue *value, } static GVariant * -mailer_prefs_map_color_to_string (const GValue *value, - const GVariantType *expected_type, - gpointer user_data) +mailer_prefs_map_rgba_to_string (const GValue *value, + const GVariantType *expected_type, + gpointer user_data) { GVariant *variant; - const GdkColor *color; + const GdkRGBA *rgba; - color = g_value_get_boxed (value); - if (color == NULL) { + rgba = g_value_get_boxed (value); + if (rgba == NULL) { variant = g_variant_new_string (""); } else { gchar *string; - /* Encode the color manually because CSS styles expect - * color codes as #rrggbb, whereas gdk_color_to_string() - * returns color codes as #rrrrggggbbbb. */ + /* Encode the color manually. */ string = g_strdup_printf ( "#%02x%02x%02x", - (gint) color->red * 256 / 65536, - (gint) color->green * 256 / 65536, - (gint) color->blue * 256 / 65536); + ((gint) (rgba->red * 255)) % 255, + ((gint) (rgba->green * 255)) % 255, + ((gint) (rgba->blue * 255)) % 255); variant = g_variant_new_string (string); g_free (string); } @@ -934,10 +932,10 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs, widget = e_builder_get_widget (prefs->builder, "colorButtonHighlightCitations"); g_settings_bind_with_mapping ( settings, "citation-color", - widget, "color", + widget, "rgba", G_SETTINGS_BIND_DEFAULT, - mailer_prefs_map_string_to_color, - mailer_prefs_map_color_to_string, + mailer_prefs_map_string_to_rgba, + mailer_prefs_map_rgba_to_string, NULL, (GDestroyNotify) NULL); g_settings_bind ( settings, "mark-citations", diff --git a/modules/settings/e-settings-mail-formatter.c b/modules/settings/e-settings-mail-formatter.c index e98bf42ec5..aa8c4325a1 100644 --- a/modules/settings/e-settings-mail-formatter.c +++ b/modules/settings/e-settings-mail-formatter.c @@ -51,17 +51,17 @@ settings_mail_formatter_get_extensible (ESettingsMailFormatter *extension) } static gboolean -settings_mail_formatter_map_string_to_color (GValue *value, - GVariant *variant, - gpointer user_data) +settings_mail_formatter_map_string_to_rgba (GValue *value, + GVariant *variant, + gpointer user_data) { - GdkColor color; + GdkRGBA rgba; const gchar *string; gboolean success = FALSE; string = g_variant_get_string (variant, NULL); - if (gdk_color_parse (string, &color)) { - g_value_set_boxed (value, &color); + if (gdk_rgba_parse (&rgba, string)) { + g_value_set_boxed (value, &rgba); success = TRUE; } @@ -138,7 +138,7 @@ settings_mail_formatter_constructed (GObject *object) settings, "citation-color", formatter, "citation-color", G_SETTINGS_BIND_GET, - settings_mail_formatter_map_string_to_color, + settings_mail_formatter_map_string_to_rgba, (GSettingsBindSetMapping) NULL, NULL, (GDestroyNotify) NULL); diff --git a/modules/text-highlight/e-mail-formatter-text-highlight.c b/modules/text-highlight/e-mail-formatter-text-highlight.c index f1a97b34a9..d4ef3693f1 100644 --- a/modules/text-highlight/e-mail-formatter-text-highlight.c +++ b/modules/text-highlight/e-mail-formatter-text-highlight.c @@ -325,10 +325,10 @@ emfe_text_highlight_format (EMailFormatterExtension *extension, "</iframe>" "</div>", part->id, part->id, uri, - e_color_to_value ((GdkColor *) + e_rgba_to_value ( e_mail_formatter_get_color ( formatter, E_MAIL_FORMATTER_COLOR_FRAME)), - e_color_to_value ((GdkColor *) + e_rgba_to_value ( e_mail_formatter_get_color ( formatter, E_MAIL_FORMATTER_COLOR_CONTENT))); |