[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sylpheed
Subject:    [sylpheed:27833] patch to display folders with unread messages near the top
From:       "Steven M. Bellovin" <smb () cs ! columbia ! edu>
Date:       2006-04-15 17:46:50
Message-ID: 20060415134650.354b9b00.smb () cs ! columbia ! edu
[Download RAW message or body]

Here's a patch I use with 2.2.1 and 2.2.4 (on NetBSD, though that
shouldn't matter) that puts folders with new or unread messages at the
top of the alphabetized list.  It doesn't do anything for nested folders,
though it should, because it wasn't immediately obvious to me how to do
that check from the routine I patched.

--- libsylph/folder.c.orig      2006-03-13 18:21:11.000000000 -0500
+++ libsylph/folder.c   2006-03-13 18:24:12.000000000 -0500
@@ -304,6 +304,13 @@
        if (item_a->stype == F_NORMAL && item_b->stype != F_NORMAL)
                return item_b->stype - item_a->stype;
 
+       /* If b has unread items and a doesn't, b is larger (ends up
+        * higher in the list) */
+       if (item_b->unread > 0 && item_a->unread == 0)
+               return 1;
+       if (item_a->unread > 0 && item_b->unread == 0)
+               return -1;
+
        /* otherwise just compare the folder names */
        str_a = g_utf8_casefold(item_a->name, -1);
        str_b = g_utf8_casefold(item_b->name, -1);

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic