[Xfce4-commits] <postler:master> Apply theme fore, back and link colour

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


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

commit de25f91572a1cae0ca0bdc6ec3ae61d754a8ec58
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sat Apr 16 03:57:42 2011 +0200

    Apply theme fore, back and link colour

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

diff --git a/postler/postler-content.vala b/postler/postler-content.vala
index 35313ed..475420b 100644
--- a/postler/postler-content.vala
+++ b/postler/postler-content.vala
@@ -116,9 +116,15 @@ public class Postler.Content : WebKit.WebView {
         .headers #extra_headers {
             display: none;
         }
-        .body {
+        * {
+            padding: 0em;
+            margin: 0em;
+        }
+        body {
             background-color: Window !important; color: WindowText !important;
             padding: 1em;
+        }
+        .body {
             font-size: 100% !important;
         }
         /* Quotations */
@@ -141,6 +147,9 @@ public class Postler.Content : WebKit.WebView {
             content: "——";
         }
         /* Addresses not underlined, but underlined when hovering */
+        a {
+            color: Link !important;
+        }
         a[href] {
             text-decoration: underline !important;
         }
@@ -1058,6 +1067,10 @@ public class Postler.Content : WebKit.WebView {
         return new_body.str;
     }
 
+    string color_to_rgb (Gdk.Color color) {
+        return color.to_string ().substring (0, 7);
+    }
+
     public void display_part (MessagePart message_part) {
         if (current_part != message_part) {
             current_part = message_part;
@@ -1119,6 +1132,13 @@ public class Postler.Content : WebKit.WebView {
                 catch (GLib.RegexError error) { }
             }
 
+            /* Use void* with style_get to avoid Vala compiler error */
+            void* link_color;
+            style_get ("link-color", out link_color);
+            string themed_style_sheet = style_sheet.replace (
+                "WindowText", color_to_rgb (style.fg[state])).replace (
+                "Window", color_to_rgb (style.base[state])).replace (
+                "Link", color_to_rgb (*((Gdk.Color*)link_color)));
             load_string ("""
                 <style text="text/css">%s</style>
                 <span class="headers">
@@ -1138,7 +1158,7 @@ public class Postler.Content : WebKit.WebView {
                 </span>
                 <p class="body" style="%s">%s</p>
                 """.
-                printf (style_sheet,
+                printf (themed_style_sheet,
                         date,
                         _("From:"), sender,
                         format_header (_("To:"), recipient),



More information about the Xfce4-commits mailing list