[Xfce4-commits] <postler:master> linkify_address() shouldn't append icon if screen is unset

Christian Dywan noreply at xfce.org
Tue Feb 15 21:34:02 CET 2011


Updating branch refs/heads/master
         to c255cbcc2d9059c798e59eba5b3929bb9e18c4d6 (commit)
       from 232e2e6d06b001b8669af5ada32d6d682d234ebd (commit)

commit c255cbcc2d9059c798e59eba5b3929bb9e18c4d6
Author: Christian Dywan <christian at twotoasts.de>
Date:   Tue Feb 15 21:02:34 2011 +0100

    linkify_address() shouldn't append icon if screen is unset
    
    This is a bit of a work around the fact that tests don't
    have a screen and don't need the icon at all. For now it's
    best to get the unit tests running again.

 postler/postler-content.vala |   21 +++++++++++++++------
 tests/parsing.vala           |    1 +
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/postler/postler-content.vala b/postler/postler-content.vala
index 0f3ff11..09b75e8 100644
--- a/postler/postler-content.vala
+++ b/postler/postler-content.vala
@@ -197,10 +197,18 @@ public class Postler.Content : WebKit.WebView {
     internal static string linkify_address (string addresses, string? arguments)
         requires (arguments == null || !arguments.contains ("<")) {
         var linkified = new StringBuilder ();
-        string edit_icon = "<b>←</b>";
-        var icon_theme = Gtk.IconTheme.get_for_screen (Gdk.Screen.get_default ());
-        if (icon_theme.has_icon ("not-starred"))
-            edit_icon = "<img src=\"" + icon_name_to_data_uri ("not-starred") + "\">";
+
+        string edit_icon = "";
+        var screen = Gdk.Screen.get_default ();
+        if (screen != null) {
+            var icon_theme = Gtk.IconTheme.get_for_screen (screen);
+            if (icon_theme.has_icon ("not-starred"))
+                edit_icon = "<img src=\""
+                    + icon_name_to_data_uri ("not-starred") + "\">";
+            else
+                edit_icon = "<b>←</b>";
+        }
+
         foreach (string address in addresses.split (",")) {
             if (address == "")
                 continue;
@@ -217,8 +225,9 @@ public class Postler.Content : WebKit.WebView {
                linkified.append (", ");
             linkified.append ("<a href=\"" + quoted + (arguments != null ? arguments : "") +
                 "\" title=\"" + original + "\">" + name + "</a>");
-            linkified.append ((" <a href=\"contact:%s:%s\">%s</a>").printf (
-                name, quoted, edit_icon));
+            if (edit_icon != "")
+                linkified.append ((" <a href=\"contact:%s:%s\">%s</a>").printf (
+                                  name, quoted, edit_icon));
         }
         return linkified.str;
     }
diff --git a/tests/parsing.vala b/tests/parsing.vala
index 61f4b1d..9d55e43 100644
--- a/tests/parsing.vala
+++ b/tests/parsing.vala
@@ -125,6 +125,7 @@ const TestCase[] encodeds = {
     { "=?iso-8859-1?Q?Lila_L=F6ffel?=", "Lila Löffel" },
     { "=?iso-8859-15?q?S=FCddeutsche?=", "Süddeutsche" },
     { "=?iso-8859-15?q?=FCddeutsche?=", "üddeutsche" },
+    { "=?UTF-8?B?QW5kcsOpIFN0w7ZzZWw=?=", "André Stösel" },
     { "=?iso-8859-15?q?S=FCddeutsche_?==?iso-8859-15?q?W=FCrste?=",
       "Süddeutsche Würste" },
     { "[Kritiker] =?iso-8859-15?q?S=FCddeutsche_?==?iso-8859-15?q?W=FCrste?=",



More information about the Xfce4-commits mailing list