Bug 1253

Summary: Sort by newest mail in thread
Product: Claws Mail (GTK 2) Reporter: Pierre Ossman <pierre-bugzilla>
Component: FoldersAssignee: users
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P3    
Version: 2.9.2   
Hardware: PC   
OS: All   

Description Pierre Ossman 2007-06-30 16:58:21 UTC
Currently, if you sort by date you get a sorting based on the initial mail in each thread. It would be more desirable to have it sort based on the most recent mail in each thread. It is very annoying to have to scroll way down just because the active thread was started a long time ago.
Comment 1 Pierre Ossman 2007-06-30 18:27:22 UTC
I'm afraid my GTK skills are abysmal, otherwise I could solve this myself. I made an attempt, which gave some effect but not completely correct:


static void summary_thread_age(GtkCTree *ctree,
				   GtkCTreeNode *node,
				   gpointer data)
{
	MsgInfo *msginfo = gtk_ctree_node_get_row_data(ctree, node);
	time_t *t = (time_t*)data;

	if (msginfo->date_t > *t)
		*t = msginfo->date_t;
}

static gint summary_cmp_by_date(GtkCList *clist,
				   gconstpointer ptr1,
				   gconstpointer ptr2)
{
	time_t t1, t2;

	const SummaryView *sv = g_object_get_data(G_OBJECT(clist), "summaryview");
	GtkCTree *ctree = GTK_CTREE(sv->ctree);
	GtkCTreeRow *row1 = (GtkCTreeRow*)ptr1;
	GtkCTreeRow *row2 = (GtkCTreeRow*)ptr2;
	MsgInfo *msginfo1 = ((GtkCListRow *)ptr1)->data;
	MsgInfo *msginfo2 = ((GtkCListRow *)ptr2)->data;

	GtkCTreeNode *node1, *node2;

//	node1 = gtk_ctree_find_node_ptr(ctree, row1);
//	node2 = gtk_ctree_find_node_ptr(ctree, row2);

	t1 = msginfo1->date_t;
	t2 = msginfo2->date_t;

	gtk_ctree_post_recursive(ctree, row1->children, summary_thread_age, &t1);
	gtk_ctree_post_recursive(ctree, row2->children, summary_thread_age, &t2);

	return t1 - t2;
}


I think my basic problem is getting a GtkCTreeNode from the GtkCListRow.
Comment 2 Paul 2007-06-30 18:50:31 UTC

*** This bug has been marked as a duplicate of bug 1233 ***