[Xfce4-commits] <postler:master> Load Adium themes from data dirs and POSTLER_ADIUM_THEME

Christian Dywan noreply at xfce.org
Tue Jun 28 05:10:02 CEST 2011


Updating branch refs/heads/master
         to 3ef473b84aa42249b66e42d4a0c05e668ecbe306 (commit)
       from ff5d85a40692c6d74deda5757cb01a3a801fdfce (commit)

commit 3ef473b84aa42249b66e42d4a0c05e668ecbe306
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sun Jun 26 19:40:17 2011 +0200

    Load Adium themes from data dirs and POSTLER_ADIUM_THEME

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

diff --git a/postler/postler-content.vala b/postler/postler-content.vala
index f0a1dc6..608cdc3 100644
--- a/postler/postler-content.vala
+++ b/postler/postler-content.vala
@@ -622,9 +622,19 @@ public class Postler.Content : WebKit.WebView {
             }
 
             /* Use Adium style if existant, otherwise fallback to internal */
-            string theme_name = "ubuntu.AdiumMessageStyle";
-            string template_path = "/usr/share/adium/message-styles/" +
-                                   theme_name + "/Contents/Resources/";
+            string theme_name = Environment.get_variable ("POSTLER_ADIUM_THEME") ?? "ubuntu";
+            string template_dir = "%s/adium/message-styles/%s.AdiumMessageStyle/Contents/Resources/";
+            string? template_path = null;
+            foreach (string data_dir in Environment.get_system_data_dirs ()) {
+                string template_folder = template_dir.printf (data_dir, theme_name);
+                if (FileUtils.test (template_folder, FileTest.EXISTS)) {
+                    template_path = template_folder;
+                    break;
+                }
+            }
+            if (template_path == null)
+                template_path = template_dir.printf (
+                    Environment.get_user_data_dir (), theme_name);
             string content_template, content_stylesheet;
             try {
                 FileUtils.get_contents (template_path + "Incoming/Content.html",



More information about the Xfce4-commits mailing list