[Xfce4-commits] <postler:master> Apply system font family and size

Christian Dywan noreply at xfce.org
Sat Apr 16 04:04:01 CEST 2011


Updating branch refs/heads/master
         to 4e43dbe93ab87053f1acafb489cceb85701566e8 (commit)
       from b85bc215b9c5930d4deca4c79938656a710356c4 (commit)

commit 4e43dbe93ab87053f1acafb489cceb85701566e8
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sat Apr 16 03:37:36 2011 +0200

    Apply system font family and size
    
    Fixes: https://bugs.launchpad.net/postler/+bug/671595

 postler/postler-content.vala |   24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/postler/postler-content.vala b/postler/postler-content.vala
index 35f14e0..35313ed 100644
--- a/postler/postler-content.vala
+++ b/postler/postler-content.vala
@@ -109,14 +109,17 @@ public class Postler.Content : WebKit.WebView {
         .headers {
             display: block;
             background-color: Window !important; color: WindowText !important;
-            font: 9pt sans-serif !important;
+            font-size: 100% !important;
+            margin: 0em;
+            padding: 0.5em;
         }
         .headers #extra_headers {
             display: none;
         }
         .body {
             background-color: Window !important; color: WindowText !important;
-            font: 10pt sans-serif !important;
+            padding: 1em;
+            font-size: 100% !important;
         }
         /* Quotations */
         blockquote {
@@ -151,7 +154,7 @@ public class Postler.Content : WebKit.WebView {
             padding: 0 1pt !important;
             max-width: 95%; overflow: hidden;
             white-space: nowrap; text-overflow: ellipsis;
-            font:10pt sans-serif !important; text-shadow: 0 0 5pt ButtonHighlight;
+            font-size: 100% !important; text-shadow: 0 0 5pt ButtonHighlight;
             background-color: ButtonFace !important; color: ButtonText !important;
             outline: ButtonFace solid thick; z-index: 9999;
         }
@@ -162,6 +165,16 @@ public class Postler.Content : WebKit.WebView {
         pre { white-space: pre-wrap; }
         """;
 
+    void font_name_changed (GLib.Object gtk_settings, GLib.ParamSpec pspec) {
+        string gtk_font_name;
+        gtk_settings.get ("gtk-font-name", out gtk_font_name);
+        var font = Pango.FontDescription.from_string (gtk_font_name);
+        settings.set ("default-font-family", font.get_family (),
+                      "cursive-font-family", font.get_family (),
+                      "fantasy-font-family", font.get_family (),
+                      "default-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) {
@@ -170,6 +183,11 @@ public class Postler.Content : WebKit.WebView {
         navigation_policy_decision_requested.connect (navigation_decision);
         create_web_view.connect (new_window_created);
         populate_popup.connect (populate_menu);
+
+        var 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));
     }
 
     internal static string format_x_mailer (string x_mailer) {



More information about the Xfce4-commits mailing list