[Xfce4-commits] <postler:master> Implement 'rich' 2-line message overview

Christian Dywan noreply at xfce.org
Wed Jun 2 18:24:04 CEST 2010


Updating branch refs/heads/master
         to 006f4d384e5109340057545cde0af589fbc41b02 (commit)
       from a9638f906f2c6fb7effade31d9ca0974314b211c (commit)

commit 006f4d384e5109340057545cde0af589fbc41b02
Author: Christian Dywan <christian at twotoasts.de>
Date:   Wed Jun 2 18:21:41 2010 +0200

    Implement 'rich' 2-line message overview

 postler/postler-messages.vala |   36 +++++++++++++++++++++++++++++-------
 1 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/postler/postler-messages.vala b/postler/postler-messages.vala
index ecb9467..6195d6f 100644
--- a/postler/postler-messages.vala
+++ b/postler/postler-messages.vala
@@ -17,6 +17,7 @@ public class Postler.Messages : Gtk.TreeView {
 
     public Postler.Content content { get; set; }
     public bool hide_read { get; set; }
+    public bool rich_rows { get; set; default = true; }
     public string? selected_location { get; set; }
 
     string last_location;
@@ -27,7 +28,6 @@ public class Postler.Messages : Gtk.TreeView {
         STATUS,
         ATTACHMENT,
         SUBJECT,
-        WEIGHT,
         FROM,
         DATE,
         SIZE,
@@ -48,8 +48,8 @@ public class Postler.Messages : Gtk.TreeView {
     }
 
     public Messages () {
-        store = new Gtk.TreeStore (10, typeof (string), typeof (string),
-            typeof (string), typeof (string), typeof (int), typeof (string),
+        store = new Gtk.TreeStore (9, typeof (string), typeof (string),
+            typeof (string), typeof (string), typeof (string),
             typeof (string), typeof (string), typeof (string), typeof (ulong));
         sort = new Gtk.TreeModelSort.with_model (store);
         set_model (sort);
@@ -63,8 +63,7 @@ public class Postler.Messages : Gtk.TreeView {
         insert_column_with_attributes (-1, _("Attachment"),
             new Gtk.CellRendererPixbuf (), "stock-id", Columns.ATTACHMENT, null);
         insert_column_with_attributes (-1, _("Subject"),
-            new Gtk.CellRendererText (), "text", Columns.SUBJECT,
-            "weight", Columns.WEIGHT, null);
+            new Gtk.CellRendererText (), "markup", Columns.SUBJECT, null);
         insert_column_with_attributes (-1, _("From"),
             new Gtk.CellRendererText (), "text", Columns.FROM, null);
         insert_column_with_attributes (-1, _("Date"),
@@ -282,14 +281,37 @@ public class Postler.Messages : Gtk.TreeView {
 
                     string charset = null;
                     string real_subject = parse_encoded (subject, out charset);
+                    real_subject = GLib.Markup.escape_text (real_subject);
                     if (last_filter != "" && !(last_filter in real_subject.down ()))
                         continue;
+
+                    if (rich_rows) {
+                        store.insert_with_values (out account_iter, null, -1,
+                            Columns.FLAGGED, flagged,
+                            Columns.STATUS, status,
+                            Columns.ATTACHMENT, null,
+                            Columns.SUBJECT,
+                                ("<span weight=\"%d\">%s</span> <small>%s</small>\n" +
+                                 "<small><tt>%s      </tt></small> %s").printf (
+                                font_weight,
+                                real_subject,
+                                format_size_for_display (info.get_size ()),
+                                date,
+                                parse_address (from)[0]),
+                            Columns.FROM, null,
+                            Columns.DATE, null,
+                            Columns.TIMESTAMP, timestamp,
+                            Columns.LOCATION, contents.get_path (),
+                            -1);
+                        continue;
+                    }
+
                     store.insert_with_values (out account_iter, null, -1,
                         Columns.FLAGGED, flagged,
                         Columns.STATUS, status,
                         Columns.ATTACHMENT, null,
-                        Columns.SUBJECT, real_subject,
-                        Columns.WEIGHT, font_weight,
+                        Columns.SUBJECT, "<span weight=\"%d\">%s</span>".printf (
+                            font_weight, real_subject),
                         Columns.FROM, parse_address (from)[0],
                         Columns.DATE, date,
                         Columns.TIMESTAMP, timestamp,



More information about the Xfce4-commits mailing list