Patch: more responsive header list model
- From: José Dapena Paz <jdapena igalia com>
- To: tinymail-devel-list <tinymail-devel-list gnome org>
- Subject: Patch: more responsive header list model
- Date: Wed, 10 Feb 2010 16:05:11 +0100
Hi,
This patch adds a new method to TnyGtkHeaderListModel, to allow to
change the behavior of the headers load, to be more responsive (and
slower.
The new method is tny_gtk_header_list_model_set_update_in_batches(). If
TRUE (default option and previous behavior) it will load in batches of
3000 headers in notify_views_add.
If FALSE, it will load in batches of 300 headers, so it will be more
responsive (allowing processing of events more frequently, more
incremental load of the data, etc).
Changelog entry:
* libtinymailui-gtk/tny-gtk-header-list-model.c:
new method tny_gtk_header_list_model_set_update_in_batches
to change the way headers are exposed to tree model. If
TRUE (previous behavior and default behavior), then it will
load 3000 headers in each run. If FALSE, it will load 300
headers in each run, so it will allow more processing of
gtk events (and more responsiveness).
--
José Dapena Paz <jdapena igalia com>
Igalia
diff --git a/libtinymailui-gtk/tny-gtk-header-list-iterator-priv.h b/libtinymailui-gtk/tny-gtk-header-list-iterator-priv.h
index 27d2bda..981ccdf 100644
--- a/libtinymailui-gtk/tny-gtk-header-list-iterator-priv.h
+++ b/libtinymailui-gtk/tny-gtk-header-list-iterator-priv.h
@@ -84,6 +84,7 @@ struct _TnyGtkHeaderListModelPriv
gint show_latest;
GPtrArray *not_latest_items;
time_t oldest_received;
+ gboolean update_in_batches;
};
G_END_DECLS
diff --git a/libtinymailui-gtk/tny-gtk-header-list-model.c b/libtinymailui-gtk/tny-gtk-header-list-model.c
index 8109959..c747063 100644
--- a/libtinymailui-gtk/tny-gtk-header-list-model.c
+++ b/libtinymailui-gtk/tny-gtk-header-list-model.c
@@ -682,7 +682,7 @@ notify_views_add (gpointer data)
if ( already_registered == 0)
mails_load_count = 100;
else
- mails_load_count = 3000;
+ mails_load_count = priv->update_in_batches?3000:300;
if (priv->items->len - already_registered > mails_load_count) {
going_tb_registered = already_registered + mails_load_count;
@@ -1230,6 +1230,7 @@ tny_gtk_header_list_model_init (TnyGtkHeaderListModel *self)
priv->ra_lock = g_mutex_new ();
priv->to_lock = g_mutex_new ();
priv->registered = 0;
+ priv->update_in_batches = TRUE;
return;
}
@@ -1537,3 +1538,12 @@ update_oldest_received (TnyGtkHeaderListModel *self, TnyHeader *header)
priv->oldest_received = date_received;
}
}
+
+void
+tny_gtk_header_list_model_set_update_in_batches (TnyGtkHeaderListModel *self,
+ gboolean update_in_batches)
+{
+ TnyGtkHeaderListModelPriv *priv = TNY_GTK_HEADER_LIST_MODEL_GET_PRIVATE (self);
+
+ priv->update_in_batches = update_in_batches;
+}
diff --git a/libtinymailui-gtk/tny-gtk-header-list-model.h b/libtinymailui-gtk/tny-gtk-header-list-model.h
index e7585a5..913a944 100644
--- a/libtinymailui-gtk/tny-gtk-header-list-model.h
+++ b/libtinymailui-gtk/tny-gtk-header-list-model.h
@@ -79,6 +79,7 @@ void tny_gtk_header_list_model_set_no_duplicates (TnyGtkHeaderListModel *self, g
gboolean tny_gtk_header_list_model_get_no_duplicates (TnyGtkHeaderListModel *self);
void tny_gtk_header_list_model_set_show_latest (TnyGtkHeaderListModel *self, gint show_latest_n);
gint tny_gtk_header_list_model_get_show_latest (TnyGtkHeaderListModel *self);
+void tny_gtk_header_list_model_set_update_in_batches (TnyGtkHeaderListModel *self, gboolean update_in_batches);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]