aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSrinivasa Ragavan <sragavan@src.gnome.org>2006-08-19 02:50:11 +0800
committerSrinivasa Ragavan <sragavan@src.gnome.org>2006-08-19 02:50:11 +0800
commit13b58cb84e3fd9c4ab2e3196699bb0681e4d0912 (patch)
tree8a02ff483ce9d2d1957dd2b4d79f31f8e1ffcc14
parent0cad073b736cf31af522dee889767957885b9ef7 (diff)
downloadgsoc2013-evolution-13b58cb84e3fd9c4ab2e3196699bb0681e4d0912.tar.gz
gsoc2013-evolution-13b58cb84e3fd9c4ab2e3196699bb0681e4d0912.tar.zst
gsoc2013-evolution-13b58cb84e3fd9c4ab2e3196699bb0681e4d0912.zip
Fix for bug #350884 (GMail like thread sorting)
svn path=/trunk/; revision=32587
-rw-r--r--mail/ChangeLog7
-rw-r--r--mail/message-list.c35
-rw-r--r--widgets/table/ChangeLog8
-rw-r--r--widgets/table/e-tree-table-adapter.c14
4 files changed, 53 insertions, 11 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 85261016d3..49724141a7 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,10 @@
+2006-08-19 Srinivasa Ragavan <sragavan@novell.com>
+
+ ** Fix for bug #350884
+
+ * message-list.c: (subtree_latest), (ml_tree_value_at): Sort thread
+ based on the date of last message received.
+
2006-08-17 Kjartan Maraas <kmaraas@gnome.org>
* message-list.c: (create_composite_cell): Plug a leak.
diff --git a/mail/message-list.c b/mail/message-list.c
index fe7e9026a4..710c520e55 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -1133,10 +1133,10 @@ subtree_size(MessageList *ml, ETreePath node)
}
static time_t
-subtree_earliest(MessageList *ml, ETreePath node, int sent)
+subtree_latest(MessageList *ml, ETreePath node, int sent)
{
CamelMessageInfo *info;
- time_t earliest = 0, date;
+ time_t latest = 0, date;
ETreePath *child;
while (node) {
@@ -1148,19 +1148,19 @@ subtree_earliest(MessageList *ml, ETreePath node, int sent)
else
date = camel_message_info_date_received(info);
- if (earliest == 0 || date < earliest)
- earliest = date;
+ if (latest == 0 || date > latest)
+ latest = date;
if ((child = e_tree_model_node_get_first_child (ml->model, node))) {
- date = subtree_earliest(ml, child, sent);
- if (earliest == 0 || (date != 0 && date < earliest))
- earliest = date;
+ date = subtree_latest(ml, child, sent);
+ if (latest == 0 || (date != 0 && date > latest))
+ latest = date;
}
node = e_tree_model_node_get_next (ml->model, node);
}
- return earliest;
+ return latest;
}
static gchar *
@@ -1288,10 +1288,25 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data)
return (void *)(str ? str : "");
case COL_SUBJECT_NORM:
return (void *) get_normalised_string (message_list, msg_info, col);
- case COL_SENT:
+ case COL_SENT: {
+ ETreePath child;
+
+ child = e_tree_model_node_get_first_child(etm, path);
+ if (child && !e_tree_node_is_expanded(message_list->tree, path)) {
+ return GINT_TO_POINTER (subtree_latest (message_list, child, 1));
+ }
+
return GINT_TO_POINTER (camel_message_info_date_sent(msg_info));
- case COL_RECEIVED:
+ }
+ case COL_RECEIVED: {
+ ETreePath child;
+
+ child = e_tree_model_node_get_first_child(etm, path);
+ if (child && !e_tree_node_is_expanded(message_list->tree, path)) {
+ return GINT_TO_POINTER (subtree_latest (message_list, child, 0));
+ }
return GINT_TO_POINTER (camel_message_info_date_received(msg_info));
+ }
case COL_TO:
str = camel_message_info_to (msg_info);
return (void *)(str ? str : "");
diff --git a/widgets/table/ChangeLog b/widgets/table/ChangeLog
index 2ce971ad46..6e8a297223 100644
--- a/widgets/table/ChangeLog
+++ b/widgets/table/ChangeLog
@@ -1,3 +1,11 @@
+2006-08-19 Srinivasa Ragavan <sragavan@novell.com>
+
+ ** Fix for bug #350884
+
+ * e-tree-table-adapter.c: (resort_model),
+ (etta_proxy_node_changed): Sort the model after for gmail like
+ display.
+
2006-07-05 Rajeev ramanathan <rajeevramanathan_2004@yaoo.co.in>
* e-cell-text.c: (ect_unrealize), (build_layout), (ect_draw): Added
diff --git a/widgets/table/e-tree-table-adapter.c b/widgets/table/e-tree-table-adapter.c
index c4585f240a..3a24fa38bc 100644
--- a/widgets/table/e-tree-table-adapter.c
+++ b/widgets/table/e-tree-table-adapter.c
@@ -82,6 +82,8 @@ struct ETreeTableAdapterPriv {
int sort_info_changed_id;
};
+static void etta_sort_info_changed (ETableSortInfo *sort_info, ETreeTableAdapter *etta);
+
static GNode *
lookup_gnode(ETreeTableAdapter *etta, ETreePath path)
{
@@ -744,12 +746,22 @@ etta_proxy_no_change (ETreeModel *etm, ETreeTableAdapter *etta)
e_table_model_no_change(E_TABLE_MODEL(etta));
}
+guint resort_model (ETreeTableAdapter *etta)
+{
+ etta_sort_info_changed (NULL, etta);
+ return FALSE;
+}
+
static void
etta_proxy_node_changed (ETreeModel *etm, ETreePath path, ETreeTableAdapter *etta)
{
update_node(etta, path);
-
e_table_model_changed(E_TABLE_MODEL(etta));
+
+ /* FIXME: Really it shouldnt be required. But a lot of thread
+ * which were supposed to be present in the list is way below
+ */
+ g_idle_add (resort_model, etta);
}
static void