aboutsummaryrefslogtreecommitdiffstats
path: root/mail/message-list.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2007-11-23 17:06:00 +0800
committerMilan Crha <mcrha@src.gnome.org>2007-11-23 17:06:00 +0800
commit1c88010c53f9a9b7466745041bf55d646bc2aa0a (patch)
tree60d7111e61e7a58b24ae8e1cdfca8645bb8c1835 /mail/message-list.c
parentc67cc6aa87d39bf8ac6d77c54b99dc9d71dc10ac (diff)
downloadgsoc2013-evolution-1c88010c53f9a9b7466745041bf55d646bc2aa0a.tar
gsoc2013-evolution-1c88010c53f9a9b7466745041bf55d646bc2aa0a.tar.gz
gsoc2013-evolution-1c88010c53f9a9b7466745041bf55d646bc2aa0a.tar.bz2
gsoc2013-evolution-1c88010c53f9a9b7466745041bf55d646bc2aa0a.tar.lz
gsoc2013-evolution-1c88010c53f9a9b7466745041bf55d646bc2aa0a.tar.xz
gsoc2013-evolution-1c88010c53f9a9b7466745041bf55d646bc2aa0a.tar.zst
gsoc2013-evolution-1c88010c53f9a9b7466745041bf55d646bc2aa0a.zip
** Fix for bug #335931
2007-11-23 Milan Crha <mcrha@redhat.com> ** Fix for bug #335931 * message-list.c: (struct _regen_list_msg): New member last_row. * message-list.c: (regen_list_regen): Store last_row for later use. * message-list.c: (regen_list_regened): Restore row based on last_row when no uid was selected before. * message-list.c: (mail_regen_list): Init new last_row member. * em-folder-view.c: (emfv_select_next_message): New helper function to select messages in list. * em-folder-view.c: (emfv_popup_mark_junk), (emfv_popup_mark_nojunk), (emfv_popup_delete): Using new helper function, so get same behavior. * message-list.h: (struct _MessageList): * message-list.c: (on_cursor_activated_cmd): Removed cursor_row member. svn path=/trunk/; revision=34567
Diffstat (limited to 'mail/message-list.c')
-rw-r--r--mail/message-list.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/mail/message-list.c b/mail/message-list.c
index 0936938d1a..b9d5cf56cb 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -3241,7 +3241,6 @@ on_cursor_activated_cmd (ETree *tree, int row, ETreePath path, gpointer user_dat
|| (message_list->cursor_uid != NULL && new_uid != NULL && !strcmp (message_list->cursor_uid, new_uid)))
return;
- message_list->cursor_row = row;
g_free (message_list->cursor_uid);
message_list->cursor_uid = g_strdup (new_uid);
@@ -3734,6 +3733,8 @@ struct _regen_list_msg {
CamelFolder *folder;
GPtrArray *summary;
+
+ int last_row; /* last selected (cursor) row */
};
/*
@@ -3758,11 +3759,16 @@ regen_list_regen (struct _mail_msg *mm)
struct _regen_list_msg *m = (struct _regen_list_msg *)mm;
GPtrArray *uids, *uidnew, *showuids, *searchuids = NULL;
CamelMessageInfo *info;
+ ETreePath cursor;
int i;
if (m->folder != m->ml->folder)
return;
+ cursor = e_tree_get_cursor (m->ml->tree);
+ if (cursor)
+ m->last_row = e_tree_table_adapter_row_of_node (e_tree_get_table_adapter (m->ml->tree), cursor);
+
e_profile_event_emit("list.getuids", m->folder->full_name, 0);
/* if we have hidedeleted on, use a search to find it out, merge with existing search if set */
@@ -3848,10 +3854,22 @@ regen_list_regen (struct _mail_msg *mm)
/* first, hide matches */
if (m->ml->hidden) {
+ int subtr = 0;
+
for (i = 0; i < uids->len; i++) {
if (g_hash_table_lookup (m->ml->hidden, uids->pdata[i]) == NULL)
g_ptr_array_add (uidnew, uids->pdata[i]);
+ else if (m->last_row >= 0) {
+ /* if we are going to hide message above last selected row, then we should
+ decrease our last row number, to put cursor on a proper place. */
+ ETreePath node = g_hash_table_lookup (m->ml->uid_nodemap, (const char *) uids->pdata[i]);
+
+ if (node && m->last_row > e_tree_table_adapter_row_of_node (e_tree_get_table_adapter (m->ml->tree), node))
+ subtr ++;
+ }
}
+
+ m->last_row -= subtr;
}
/* then calculate the subrange visible and chop it out */
@@ -3970,6 +3988,19 @@ regen_list_regened (struct _mail_msg *mm)
m->ml->pending_select_uid = NULL;
message_list_select_uid(m->ml, uid);
g_free(uid);
+ } else if (m->ml->regen == NULL && m->ml->cursor_uid == NULL && m->last_row != -1) {
+ ETreeTableAdapter *etta = e_tree_get_table_adapter (m->ml->tree);
+
+ if (m->last_row >= e_table_model_row_count (E_TABLE_MODEL (etta)))
+ m->last_row = e_table_model_row_count (E_TABLE_MODEL (etta)) - 1;
+
+ if (m->last_row >= 0) {
+ ETreePath path;
+
+ path = e_tree_table_adapter_node_at_row (etta, m->last_row);
+ if (path)
+ select_path (m->ml, path);
+ }
}
g_signal_emit (m->ml, message_list_signals[MESSAGE_LIST_BUILT], 0);
@@ -4095,6 +4126,7 @@ mail_regen_list (MessageList *ml, const char *search, const char *hideexpr, Came
g_object_ref(ml);
m->folder = ml->folder;
camel_object_ref(m->folder);
+ m->last_row = -1;
if ((!m->hidedel || !m->dotree) && ml->thread_tree) {
camel_folder_thread_messages_unref(ml->thread_tree);