diff options
Diffstat (limited to 'modules')
-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 |
3 files changed, 28 insertions, 30 deletions
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))); |