Patch: better handling of header list store insertions notification



	Hi,

	This patch makes the notification for insertions work timeout work. We
implemented a timeout for making notificacions of new messages in the
list store be done on a timeout to batch blocks of messages.

	But this timeout was renewed continuously so it was never played while
we were loading a big set of messages very fast. This is what happens
when you open a folder with lots of cached messages.

	With this change, the timeout will play more times, so user will get
more feedback on the load of messages. If we add this to the already
committed change that makes summary return the latest messages, we
should cover better the case of a user accessing a very big folder.

Changelog entry:

	* libtinymailui-gtk/tny-gtk-header-list-model.c 
	(tny_gtk_header_list_model_prepend): don't restart
	the views notify timeout on each message add.

	* libtinymailui-gtk/tny-gtk-header-list-model.c: initial
	views notify timeout run in 1 ms.


-- 
José Dapena Paz <jdapena igalia com>
Igalia
diff --git a/ChangeLog b/ChangeLog
index d7e38af..a8b47f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2009-07-13  Jose Dapena Paz  <jdapena igalia com>
+
+	* libtinymailui-gtk/tny-gtk-header-list-model.c 
+	(tny_gtk_header_list_model_prepend): don't restart
+	the views notify timeout on each message add.
+
+	* libtinymailui-gtk/tny-gtk-header-list-model.c: initial
+	views notify timeout run in 1 ms.
+
 2009-07-10  Jose Dapena Paz  <jdapena igalia com>
 
 	* libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.c:
diff --git a/libtinymailui-gtk/tny-gtk-header-list-model.c b/libtinymailui-gtk/tny-gtk-header-list-model.c
index b8674af..a05c6ae 100644
--- a/libtinymailui-gtk/tny-gtk-header-list-model.c
+++ b/libtinymailui-gtk/tny-gtk-header-list-model.c
@@ -766,14 +766,11 @@ tny_gtk_header_list_model_prepend (TnyList *self, GObject* item)
 		priv->updating_views = 0;
 		g_object_ref (self);
 
-		if (priv->add_timeout > 0) {
-			g_source_remove (priv->add_timeout);
-			priv->add_timeout = 0;
+		if (priv->add_timeout == 0) {
+			priv->add_timeout = g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE, 
+								priv->timeout_span, notify_views_add, self, 
+								notify_views_add_destroy);
 		}
-
-		priv->add_timeout = g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE, 
-			priv->timeout_span, notify_views_add, self, 
-			notify_views_add_destroy);
 	}
 
 	g_mutex_unlock (priv->ra_lock);
@@ -1196,7 +1193,7 @@ tny_gtk_header_list_model_init (TnyGtkHeaderListModel *self)
 	g_static_rec_mutex_init (priv->iterator_lock);
 	priv->cur_len = 0;
 
-	priv->timeout_span = 100;
+	priv->timeout_span = 1;
 	priv->del_timeouts = NULL;
 	priv->add_timeout = 0;
 	priv->items = g_ptr_array_sized_new (1000);
@@ -1278,7 +1275,7 @@ tny_gtk_header_list_model_set_folder (TnyGtkHeaderListModel *self, TnyFolder *fo
 
 	g_static_rec_mutex_lock (priv->iterator_lock);
 
-	priv->timeout_span = 100;
+	priv->timeout_span = 1;
 	if (priv->add_timeout > 0) {
 		g_source_remove (priv->add_timeout);
 		priv->add_timeout = 0;


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