aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2013-04-23 20:59:09 +0800
committerMilan Crha <mcrha@redhat.com>2013-04-23 20:59:09 +0800
commitb064d64be7e2e9444721beb7a02038f638edab4c (patch)
tree35183e5a83eb22078db23835538ea9e07b4b6d2a /modules
parentbd48b0a0f42696d2e8cb5eba10a3e0c123e9395d (diff)
downloadgsoc2013-evolution-b064d64be7e2e9444721beb7a02038f638edab4c.tar
gsoc2013-evolution-b064d64be7e2e9444721beb7a02038f638edab4c.tar.gz
gsoc2013-evolution-b064d64be7e2e9444721beb7a02038f638edab4c.tar.bz2
gsoc2013-evolution-b064d64be7e2e9444721beb7a02038f638edab4c.tar.lz
gsoc2013-evolution-b064d64be7e2e9444721beb7a02038f638edab4c.tar.xz
gsoc2013-evolution-b064d64be7e2e9444721beb7a02038f638edab4c.tar.zst
gsoc2013-evolution-b064d64be7e2e9444721beb7a02038f638edab4c.zip
[EMailFormatter] Use GdkRGBA and GtkStyleContext to get theme colors
It could happen that header text color had been picked white one time, but the other time black as expected (for me usually when I started Evolution in Calendar and moved to Mail view, the header text color was white, while when starting in Mail view it was black). The change to use GtkStyleContext is there only as a cleanup from deprecated GtkStyle, and to make things easier too, because both GtkStyle and the GtkStyleContext had set white color for some reason.
Diffstat (limited to 'modules')
-rw-r--r--modules/mail/em-mailer-prefs.c40
-rw-r--r--modules/settings/e-settings-mail-formatter.c14
-rw-r--r--modules/text-highlight/e-mail-formatter-text-highlight.c4
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)));