aboutsummaryrefslogtreecommitdiffstats
path: root/mail/e-mail-display.c
diff options
context:
space:
mode:
authorDan Vrátil <dvratil@redhat.com>2012-04-12 18:48:00 +0800
committerDan Vrátil <dvratil@redhat.com>2012-04-12 18:48:00 +0800
commit13762515153f9e254e5c17fb747ad76121f8710c (patch)
tree4bdc98861fe6fdb55a120a9ac10ca1e7cdf22216 /mail/e-mail-display.c
parent870b676d8b082a61c267ce8ca27020946ca6d88f (diff)
downloadgsoc2013-evolution-13762515153f9e254e5c17fb747ad76121f8710c.tar.gz
gsoc2013-evolution-13762515153f9e254e5c17fb747ad76121f8710c.tar.zst
gsoc2013-evolution-13762515153f9e254e5c17fb747ad76121f8710c.zip
Bug #673108 - Font settings and monospace fonts don't work
Diffstat (limited to 'mail/e-mail-display.c')
-rw-r--r--mail/e-mail-display.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c
index a1d95bdaaa..d1f3137c80 100644
--- a/mail/e-mail-display.c
+++ b/mail/e-mail-display.c
@@ -66,6 +66,8 @@ struct _EMailDisplayPrivate {
GtkActionGroup *images_actions;
gint force_image_load: 1;
+
+ GSettings *settings;
};
enum {
@@ -314,6 +316,11 @@ mail_display_dispose (GObject *object)
priv->formatter = NULL;
}
+ if (priv->settings) {
+ g_object_unref (priv->settings);
+ priv->settings = NULL;
+ }
+
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (parent_class)->dispose (object);
}
@@ -1180,9 +1187,42 @@ mail_display_frame_created (WebKitWebView *web_view,
}
static void
+mail_display_set_fonts (EWebView *web_view,
+ PangoFontDescription **monospace,
+ PangoFontDescription **variable)
+{
+ EMailDisplay *display = E_MAIL_DISPLAY (web_view);
+ gboolean use_custom_font;
+ gchar *monospace_font, *variable_font;
+
+ use_custom_font = g_settings_get_boolean (display->priv->settings, "use-custom-font");
+ if (!use_custom_font) {
+ *monospace = NULL;
+ *variable = NULL;
+ return;
+ }
+
+ monospace_font = g_settings_get_string (
+ display->priv->settings,
+ "monospace-font");
+ variable_font = g_settings_get_string (
+ display->priv->settings,
+ "variable-width-font");
+
+ *monospace = monospace_font ? pango_font_description_from_string (monospace_font) : NULL;
+ *variable = variable_font ? pango_font_description_from_string (variable_font) : NULL;
+
+ if (monospace_font)
+ g_free (monospace_font);
+ if (variable_font)
+ g_free (variable_font);
+}
+
+static void
e_mail_display_class_init (EMailDisplayClass *class)
{
GObjectClass *object_class;
+ EWebViewClass *web_view_class;
GtkWidgetClass *widget_class;
parent_class = g_type_class_peek_parent (class);
@@ -1193,6 +1233,9 @@ e_mail_display_class_init (EMailDisplayClass *class)
object_class->get_property = mail_display_get_property;
object_class->dispose = mail_display_dispose;
+ web_view_class = E_WEB_VIEW_CLASS (class);
+ web_view_class->set_fonts = mail_display_set_fonts;
+
widget_class = GTK_WIDGET_CLASS (class);
widget_class->realize = mail_display_realize;
widget_class->style_set = mail_display_style_set;
@@ -1280,6 +1323,19 @@ e_mail_display_init (EMailDisplay *display)
g_signal_connect (display, "frame-created",
G_CALLBACK (mail_display_frame_created), NULL);
+ display->priv->settings = g_settings_new ("org.gnome.evolution.mail");
+ g_signal_connect_swapped (
+ display->priv->settings , "changed::monospace-font",
+ G_CALLBACK (e_web_view_update_fonts), display);
+ g_signal_connect_swapped (
+ display->priv->settings , "changed::variable-width-font",
+ G_CALLBACK (e_web_view_update_fonts), display);
+ g_signal_connect_swapped (
+ display->priv->settings , "changed::use-custom-font",
+ G_CALLBACK (e_web_view_update_fonts), display);
+
+ e_web_view_update_fonts (E_WEB_VIEW (display));
+
main_frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (display));
g_signal_connect (main_frame, "notify::load-status",
G_CALLBACK (setup_DOM_bindings), NULL);