[Xfce4-commits] <postler:master> Use monospace font from GLib.Settings if available
Christian Dywan
noreply at xfce.org
Thu Jun 9 04:04:01 CEST 2011
Updating branch refs/heads/master
to 9ca1be402e62c521e60973ae847ce7e659653e51 (commit)
from ef9d6a53f76a6557d2b8494cc7b8e04cdb312b4b (commit)
commit 9ca1be402e62c521e60973ae847ce7e659653e51
Author: Christian Dywan <christian at twotoasts.de>
Date: Wed Jun 8 22:14:08 2011 +0200
Use monospace font from GLib.Settings if available
postler/postler-content.vala | 19 ++++++++++++++++++-
1 files changed, 18 insertions(+), 1 deletions(-)
diff --git a/postler/postler-content.vala b/postler/postler-content.vala
index 83ec1f2..3fdc5cd 100644
--- a/postler/postler-content.vala
+++ b/postler/postler-content.vala
@@ -101,6 +101,9 @@ public class Postler.Content : WebKit.WebView {
public MessagePart? html_part { get; private set; }
public MessagePart? text_part { get; private set; }
+ Gtk.Settings gtk_settings;
+ GLib.Settings glib_settings;
+
const string style_sheet = """
.headers {
display: block;
@@ -180,6 +183,13 @@ public class Postler.Content : WebKit.WebView {
"default-font-size", font.get_size () / Pango.SCALE);
}
+ void monospace_font_changed (GLib.Settings glib_settings, string key) {
+ string monospace_font = glib_settings.get_string (key);
+ var font = Pango.FontDescription.from_string (monospace_font);
+ settings.set ("monospace-font-family", font.get_family (),
+ "default-monospace-font-size", font.get_size () / Pango.SCALE);
+ }
+
public Content () {
settings.set ("enable-scripts", false, "enable-plugins", false);
if (settings.get_class ().find_property ("enable-private-browsing") != null) {
@@ -189,10 +199,17 @@ public class Postler.Content : WebKit.WebView {
create_web_view.connect (new_window_created);
populate_popup.connect (populate_menu);
- var gtk_settings = Gtk.Settings.get_for_screen (get_screen ());
+ gtk_settings = Gtk.Settings.get_for_screen (get_screen ());
gtk_settings.notify["gtk-font-name"].connect (font_name_changed);
font_name_changed (gtk_settings,
new GLib.ParamSpecString ("gtk-font-name", "", "", "", 0));
+ foreach (string schema in GLib.Settings.list_schemas ()) {
+ if (schema != "org.gnome.desktop.interface")
+ continue;
+ glib_settings = new GLib.Settings (schema);
+ glib_settings.changed["monospace-font-name"].connect (monospace_font_changed);
+ monospace_font_changed (glib_settings, "monospace-font-name");
+ }
}
internal static string format_x_mailer (string x_mailer) {
More information about the Xfce4-commits
mailing list