aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@gnome-db.org>2011-10-24 17:30:20 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2011-10-24 17:30:20 +0800
commitbd149b27954af20cf3f860164486191b0e879e89 (patch)
tree323c26ba15a7e15242c2749b391b5ffa59762fed /modules
parent3b32549c69267295a9a7b482e4a6ca2db9e6c73f (diff)
parent8c67e84f9bf1803108f7a004513e37c6ef22d41f (diff)
downloadgsoc2013-evolution-bd149b27954af20cf3f860164486191b0e879e89.tar.gz
gsoc2013-evolution-bd149b27954af20cf3f860164486191b0e879e89.tar.zst
gsoc2013-evolution-bd149b27954af20cf3f860164486191b0e879e89.zip
Merge branch 'master' into wip/gsettings
Diffstat (limited to 'modules')
-rw-r--r--modules/mail/e-mail-config-web-view.c35
1 files changed, 31 insertions, 4 deletions
diff --git a/modules/mail/e-mail-config-web-view.c b/modules/mail/e-mail-config-web-view.c
index ebab286a2d..8f838b3295 100644
--- a/modules/mail/e-mail-config-web-view.c
+++ b/modules/mail/e-mail-config-web-view.c
@@ -20,6 +20,9 @@
#include <config.h>
#endif
+#include <stdio.h>
+#include <string.h>
+
#include "e-mail-config-web-view.h"
#include <libebackend/e-extension.h>
@@ -42,6 +45,24 @@ struct _EMailConfigWebViewClass {
static gpointer parent_class;
+/* replaces content of color string */
+static void
+fix_color_string (gchar *color_string)
+{
+ GdkColor color;
+
+ if (!color_string || strlen (color_string) < 13)
+ return;
+
+ if (!gdk_color_parse (color_string, &color))
+ return;
+
+ sprintf (color_string, "#%02x%02x%02x",
+ (gint) color.red * 256 / 65536,
+ (gint) color.green * 256 / 65536,
+ (gint) color.blue * 256 / 65536);
+}
+
static void
mail_config_web_view_load_style (EMailConfigWebView *extension)
{
@@ -78,13 +99,16 @@ mail_config_web_view_load_style (EMailConfigWebView *extension)
buffer = g_string_new ("EWebView {\n");
+ fix_color_string (citation_color);
+ fix_color_string (spell_color);
+
if (custom_fonts && variable_font != NULL)
g_string_append_printf (
buffer, " font: %s;\n", variable_font);
if (custom_fonts && monospace_font != NULL)
g_string_append_printf (
- buffer, " -GtkHTML-fixed-font-name: %s;\n",
+ buffer, " -GtkHTML-fixed-font-name: '%s';\n",
monospace_font);
if (mark_citations && citation_color != NULL)
@@ -94,7 +118,7 @@ mail_config_web_view_load_style (EMailConfigWebView *extension)
if (spell_color != NULL)
g_string_append_printf (
- buffer, " -GtkHTML-spell-error-color: %s\n",
+ buffer, " -GtkHTML-spell-error-color: %s;\n",
spell_color);
g_string_append (buffer, "}\n");
@@ -113,6 +137,9 @@ mail_config_web_view_load_style (EMailConfigWebView *extension)
g_free (variable_font);
g_free (citation_color);
g_free (spell_color);
+
+ gtk_style_context_invalidate (
+ gtk_widget_get_style_context (GTK_WIDGET (e_extension_get_extensible (E_EXTENSION (extension)))));
}
static void
@@ -143,13 +170,13 @@ mail_config_web_view_realize (GtkWidget *widget,
widget, "magic-smileys",
G_BINDING_SYNC_CREATE);
- mail_config_web_view_load_style (extension);
-
gtk_style_context_add_provider (
gtk_widget_get_style_context (widget),
GTK_STYLE_PROVIDER (extension->css_provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ mail_config_web_view_load_style (extension);
+
/* Reload the style sheet when certain settings change. */
g_signal_connect_swapped (