[evolution/webkit] Bug #645476 - Avoid scroll to cursor on folder change in message list



commit a0684bd78e1b843d338050031607461b0790a9b0
Author: Milan Crha <mcrha redhat com>
Date:   Thu May 12 09:18:34 2011 +0200

    Bug #645476 - Avoid scroll to cursor on folder change in message list

 mail/message-list.c |   27 +++++++++++++++------------
 1 files changed, 15 insertions(+), 12 deletions(-)
---
diff --git a/mail/message-list.c b/mail/message-list.c
index 811f5e9..592e8e1 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -215,7 +215,7 @@ static gchar *filter_size (gint size);
 
 /* note: @changes is owned/freed by the caller */
 /*static void mail_do_regenerate_messagelist (MessageList *list, const gchar *search, const gchar *hideexpr, CamelFolderChangeInfo *changes);*/
-static void mail_regen_list (MessageList *ml, const gchar *search, const gchar *hideexpr, CamelFolderChangeInfo *changes);
+static void mail_regen_list (MessageList *ml, const gchar *search, const gchar *hideexpr, CamelFolderChangeInfo *changes, gboolean scroll_to_cursor);
 static void mail_regen_cancel (MessageList *ml);
 
 static void clear_info (gchar *key, ETreePath *node, MessageList *ml);
@@ -2422,7 +2422,7 @@ ml_tree_sorting_changed (ETreeTableAdapter *adapter, MessageList *ml)
 			ml->thread_tree = NULL;
 		}
 
-		mail_regen_list (ml, ml->search, NULL, NULL);
+		mail_regen_list (ml, ml->search, NULL, NULL, TRUE);
 
 		return TRUE;
 	}
@@ -3741,7 +3741,7 @@ folder_changed (CamelFolder *folder,
 	}
 
 	/* XXX This apparently eats the ChangeFolderChangeInfo. */
-	mail_regen_list (ml, ml->search, NULL, altered_changes);
+	mail_regen_list (ml, ml->search, NULL, altered_changes, FALSE);
 }
 
 /**
@@ -3862,7 +3862,7 @@ message_list_set_folder (MessageList *message_list,
 			!(folder->folder_flags & CAMEL_FOLDER_IS_TRASH);
 
 		if (message_list->frozen == 0)
-			mail_regen_list (message_list, message_list->search, NULL, NULL);
+			mail_regen_list (message_list, message_list->search, NULL, NULL, TRUE);
 	}
 }
 
@@ -4137,7 +4137,7 @@ message_list_thaw (MessageList *ml)
 
 	ml->frozen--;
 	if (ml->frozen == 0) {
-		mail_regen_list (ml, ml->frozen_search?ml->frozen_search:ml->search, NULL, NULL);
+		mail_regen_list (ml, ml->frozen_search ? ml->frozen_search : ml->search, NULL, NULL, TRUE);
 		g_free (ml->frozen_search);
 		ml->frozen_search = NULL;
 	}
@@ -4151,7 +4151,7 @@ message_list_set_threaded_expand_all (MessageList *ml)
 		ml->expand_all = 1;
 
 		if (ml->frozen == 0)
-			mail_regen_list (ml, ml->search, NULL, NULL);
+			mail_regen_list (ml, ml->search, NULL, NULL, TRUE);
 	}
 }
 
@@ -4162,7 +4162,7 @@ message_list_set_threaded_collapse_all (MessageList *ml)
 		ml->collapse_all = 1;
 
 		if (ml->frozen == 0)
-			mail_regen_list (ml, ml->search, NULL, NULL);
+			mail_regen_list (ml, ml->search, NULL, NULL, TRUE);
 	}
 }
 
@@ -4173,7 +4173,7 @@ message_list_set_threaded (MessageList *ml, gboolean threaded)
 		ml->threaded = threaded;
 
 		if (ml->frozen == 0)
-			mail_regen_list (ml, ml->search, NULL, NULL);
+			mail_regen_list (ml, ml->search, NULL, NULL, TRUE);
 	}
 }
 
@@ -4184,7 +4184,7 @@ message_list_set_hidedeleted (MessageList *ml, gboolean hidedeleted)
 		ml->hidedeleted = hidedeleted;
 
 		if (ml->frozen == 0)
-			mail_regen_list (ml, ml->search, NULL, NULL);
+			mail_regen_list (ml, ml->search, NULL, NULL, TRUE);
 	}
 }
 
@@ -4261,7 +4261,7 @@ message_list_set_search (MessageList *ml, const gchar *search)
 #endif
 
 	if (ml->frozen == 0)
-		mail_regen_list (ml, search, NULL, NULL);
+		mail_regen_list (ml, search, NULL, NULL, TRUE);
 	else {
 		g_free (ml->frozen_search);
 		ml->frozen_search = g_strdup (search);
@@ -4460,6 +4460,7 @@ struct _regen_list_msg {
 	gboolean hidedel;	/* we want to/dont want to show deleted messages */
 	gboolean hidejunk;	/* we want to/dont want to show junk messages */
 	gboolean thread_subject;
+	gboolean scroll_to_cursor; /* whether ensure scrolling to the cursor after rebuild */
 	CamelFolderThread *tree;
 
 	CamelFolder *folder;
@@ -4641,7 +4642,8 @@ regen_list_done (struct _regen_list_msg *m)
 
 	tree = E_TREE (m->ml);
 
-	e_tree_show_cursor_after_reflow (tree);
+	if (m->scroll_to_cursor)
+		e_tree_show_cursor_after_reflow (tree);
 
 	g_signal_handlers_block_by_func (e_tree_get_table_adapter (tree), ml_tree_sorting_changed, m->ml);
 
@@ -4835,7 +4837,7 @@ mail_regen_cancel (MessageList *ml)
 }
 
 static void
-mail_regen_list (MessageList *ml, const gchar *search, const gchar *hideexpr, CamelFolderChangeInfo *changes)
+mail_regen_list (MessageList *ml, const gchar *search, const gchar *hideexpr, CamelFolderChangeInfo *changes, gboolean scroll_to_cursor)
 {
 	struct _regen_list_msg *m;
 	GConfClient *client;
@@ -4882,6 +4884,7 @@ mail_regen_list (MessageList *ml, const gchar *search, const gchar *hideexpr, Ca
 	m->hidedel = ml->hidedeleted;
 	m->hidejunk = ml->hidejunk;
 	m->thread_subject = thread_subject;
+	m->scroll_to_cursor = scroll_to_cursor;
 	m->folder = g_object_ref (ml->folder);
 	m->last_row = -1;
 	m->expand_state = NULL;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]