[Xfce4-commits] <thunar:master> Readd the has-handler check when inserting rows.
Nick Schermer
noreply at xfce.org
Sun Nov 11 01:36:01 CET 2012
Updating branch refs/heads/master
to bf50d845959d7b2cff3ec2c5b964f657a30f8461 (commit)
from b8f806d8a71c21a369dab55bdd6a67dbb00b4f71 (commit)
commit bf50d845959d7b2cff3ec2c5b964f657a30f8461
Author: Nick Schermer <nick at xfce.org>
Date: Sat Nov 10 22:57:44 2012 +0100
Readd the has-handler check when inserting rows.
This has some benefit when the folder is already loaded
in another view.
thunar/thunar-list-model.c | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/thunar/thunar-list-model.c b/thunar/thunar-list-model.c
index 2fc6f75..2cdeec2 100644
--- a/thunar/thunar-list-model.c
+++ b/thunar/thunar-list-model.c
@@ -1197,6 +1197,7 @@ thunar_list_model_files_added (ThunarFolder *folder,
gint *indices;
GSequenceIter *row;
GList *lp;
+ gboolean has_handler;
/* we use a simple trick here to avoid allocating
* GtkTreePath's again and again, by simply accessing
@@ -1206,6 +1207,9 @@ thunar_list_model_files_added (ThunarFolder *folder,
path = gtk_tree_path_new_first ();
indices = gtk_tree_path_get_indices (path);
+ /* check if we have any handlers connected for "row-inserted" */
+ has_handler = g_signal_has_handler_pending (G_OBJECT (store), store->row_inserted_id, 0, FALSE);
+
/* process all added files */
for (lp = files; lp != NULL; lp = lp->next)
{
@@ -1224,11 +1228,14 @@ thunar_list_model_files_added (ThunarFolder *folder,
row = g_sequence_insert_sorted (store->rows, file,
thunar_list_model_cmp_func, store);
- /* generate an iterator for the new item */
- GTK_TREE_ITER_INIT (iter, store->stamp, row);
+ if (has_handler)
+ {
+ /* generate an iterator for the new item */
+ GTK_TREE_ITER_INIT (iter, store->stamp, row);
- indices[0] = g_sequence_iter_get_position (row);
- gtk_tree_model_row_inserted (GTK_TREE_MODEL (store), path, &iter);
+ indices[0] = g_sequence_iter_get_position (row);
+ gtk_tree_model_row_inserted (GTK_TREE_MODEL (store), path, &iter);
+ }
}
}
More information about the Xfce4-commits
mailing list