[Xfce4-commits] <postler:master> Display up to 12 recipients, otherwise 'and others'

Christian Dywan noreply at xfce.org
Sun Jun 26 03:20:02 CEST 2011


Updating branch refs/heads/master
         to 29b5ea263ed4edce7d61f9320fd675c700a58232 (commit)
       from 9829b764ae34a8185c7651b52a3627c2eec1c071 (commit)

commit 29b5ea263ed4edce7d61f9320fd675c700a58232
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sat Jun 25 23:19:04 2011 +0200

    Display up to 12 recipients, otherwise 'and others'

 postler/postler-content.vala |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/postler/postler-content.vala b/postler/postler-content.vala
index 81c03c6..50c671d 100644
--- a/postler/postler-content.vala
+++ b/postler/postler-content.vala
@@ -188,6 +188,7 @@ public class Postler.Content : WebKit.WebView {
                 edit_icon = "<b>←</b>";
         }
 
+        int count = 0;
         foreach (string address in addresses.split (",")) {
             if (address == "")
                 continue;
@@ -198,6 +199,9 @@ public class Postler.Content : WebKit.WebView {
             string[] parsed = Postler.Contact.parse (address);
             string name = html_escape (parsed[0]);
             string quoted = html_escape (address);
+            count++;
+            if (count > 12)
+                continue;
             if (linkified.len > 0)
                linkified.append (", ");
             linkified.append ("<a href=\"" + quoted + (arguments != null ? arguments : "") +
@@ -206,6 +210,9 @@ public class Postler.Content : WebKit.WebView {
                 linkified.append ((" <a href=\"contact:%s:%s\">%s</a>").printf (
                                   name, html_escape (parsed[1]), edit_icon));
         }
+        /* FIXME: provide a way to see those others */
+        if (count > 12)
+            linkified.append_printf (_(" and %d others"), count - 12);
         return linkified.str;
     }
 



More information about the Xfce4-commits mailing list