aboutsummaryrefslogtreecommitdiff
path: root/libsylph
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-09-13 06:00:29 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-09-13 06:00:29 +0000
commit2d99fe5ebda8a9ec92f94cc22b1c16739f19f3da (patch)
tree0752b703dc18efc4309cc0d17d1fd65694341833 /libsylph
parent818d22882b42a3cd7c73f6bbceb39cb4066f3d74 (diff)
added 'View/Sort/by thread date'.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@574 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph')
-rw-r--r--libsylph/enums.h1
-rw-r--r--libsylph/folder.c3
-rw-r--r--libsylph/folder.h1
-rw-r--r--libsylph/procmsg.c24
-rw-r--r--libsylph/procmsg.h1
5 files changed, 30 insertions, 0 deletions
diff --git a/libsylph/enums.h b/libsylph/enums.h
index 13ac2a18..cfd2a42c 100644
--- a/libsylph/enums.h
+++ b/libsylph/enums.h
@@ -42,6 +42,7 @@ typedef enum
S_COL_MSG_INFO,
S_COL_LABEL,
+ S_COL_TDATE,
S_COL_TO,
S_COL_FOREGROUND,
diff --git a/libsylph/folder.c b/libsylph/folder.c
index 25db6b24..d6fbdc95 100644
--- a/libsylph/folder.c
+++ b/libsylph/folder.c
@@ -1288,6 +1288,8 @@ static gboolean folder_build_tree(GNode *node, gpointer data)
sort_key = SORT_BY_SIZE;
else if (!strcmp(attr->value, "date"))
sort_key = SORT_BY_DATE;
+ else if (!strcmp(attr->value, "thread-date"))
+ sort_key = SORT_BY_TDATE;
else if (!strcmp(attr->value, "from"))
sort_key = SORT_BY_FROM;
else if (!strcmp(attr->value, "subject"))
@@ -1476,6 +1478,7 @@ static void folder_write_list_recursive(GNode *node, gpointer data)
static gchar *folder_item_stype_str[] = {"normal", "inbox", "outbox",
"draft", "queue", "trash"};
static gchar *sort_key_str[] = {"none", "number", "size", "date",
+ "thread-date",
"from", "subject", "score", "label",
"mark", "unread", "mime", "to"};
diff --git a/libsylph/folder.h b/libsylph/folder.h
index 0908e241..bff4ad22 100644
--- a/libsylph/folder.h
+++ b/libsylph/folder.h
@@ -86,6 +86,7 @@ typedef enum
SORT_BY_NUMBER,
SORT_BY_SIZE,
SORT_BY_DATE,
+ SORT_BY_TDATE,
SORT_BY_FROM,
SORT_BY_SUBJECT,
SORT_BY_SCORE,
diff --git a/libsylph/procmsg.c b/libsylph/procmsg.c
index 57eff70a..dd178e6c 100644
--- a/libsylph/procmsg.c
+++ b/libsylph/procmsg.c
@@ -850,6 +850,30 @@ GNode *procmsg_get_thread_tree(GSList *mlist)
return root;
}
+static gboolean procmsg_thread_date_func(GNode *node, gpointer data)
+{
+ guint *tdate = (guint *)data;
+ MsgInfo *msginfo = (MsgInfo *)node->data;
+
+ if (*tdate < msginfo->date_t)
+ *tdate = msginfo->date_t;
+
+ return FALSE;
+}
+
+guint procmsg_get_thread_date(GNode *node)
+{
+ guint tdate = 0;
+
+ g_return_val_if_fail(node != NULL && node->parent != NULL &&
+ node->parent->parent == NULL, 0);
+
+ g_node_traverse(node, G_PRE_ORDER, G_TRAVERSE_ALL, -1,
+ procmsg_thread_date_func, &tdate);
+
+ return tdate;
+}
+
gint procmsg_move_messages(GSList *mlist)
{
GSList *cur, *movelist = NULL;
diff --git a/libsylph/procmsg.h b/libsylph/procmsg.h
index 14c2b6d7..a54ac1a3 100644
--- a/libsylph/procmsg.h
+++ b/libsylph/procmsg.h
@@ -249,6 +249,7 @@ void procmsg_clear_cache (FolderItem *item);
void procmsg_clear_mark (FolderItem *item);
GNode *procmsg_get_thread_tree (GSList *mlist);
+guint procmsg_get_thread_date (GNode *node);
gint procmsg_move_messages (GSList *mlist);
gint procmsg_copy_messages (GSList *mlist);