[Xfce4-commits] <postler:master> Implement Priority folder without projects

Christian Dywan noreply at xfce.org
Thu Jul 14 02:02:03 CEST 2011


Updating branch refs/heads/master
         to aeb90c0efa0fd7b6ce309ee263059fb01fd9e573 (commit)
       from 75a65176e3a58a959ef7e8c740b4dd9621e2ec8a (commit)

commit aeb90c0efa0fd7b6ce309ee263059fb01fd9e573
Author: Christian Dywan <christian at twotoasts.de>
Date:   Wed Jul 13 21:13:41 2011 +0200

    Implement Priority folder without projects
    
    Only unread, flagged or priority messages are shown and
    projects ie. notification messages are excluded.

 postler/postler-folders.vala |    2 +-
 postler/postler-index.vala   |   13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/postler/postler-folders.vala b/postler/postler-folders.vala
index a9dc245..3f8dd21 100644
--- a/postler/postler-folders.vala
+++ b/postler/postler-folders.vala
@@ -61,7 +61,7 @@ public class Postler.Folders : Gtk.Toolbar {
             }
         }
 
-        var hide_read = folder_button (group, _("_Unread Mail"), "search:unread/1");
+        var hide_read = folder_button (group, _("_Priority"), "search:priority//INBOX/");
         insert (hide_read, -1);
         group = hide_read.get_group ();
         var notifications = folder_button (group, _("_Notifications"), "search:project/_%");
diff --git a/postler/postler-index.vala b/postler/postler-index.vala
index b5d7b25..c006ac5 100644
--- a/postler/postler-index.vala
+++ b/postler/postler-index.vala
@@ -246,6 +246,19 @@ namespace Postler {
                     field = "recipients";
                 else if (field == "fulltext")
                     field = "excerpt";
+                else if (field == "priority") {
+                    /* Priority is like uri plus required flags */
+                    string cond = """
+                        project IS NULL
+                        AND (unread = 1 OR flagged = 1 OR priority = 1)
+                        AND uri LIKE '%%%s%%'
+                        """
+                        .printf (parts[1].replace ("\'", "\'\'"));
+                    if (database.prepare_v2 (sql.replace ("$CASE", cond),
+                                             -1, out statement) != Sqlite.OK)
+                        throw new GLib.FileError.FAILED (_("Failed to search messages: %s"), database.errmsg ());
+                    return null;
+                }
                 /* We can use the prepared statement for uri search */
                 if (field != "uri") {
                     if (dates == null) {



More information about the Xfce4-commits mailing list