From e1b13312f975f38d3d7437f28299912eff6947e0 Mon Sep 17 00:00:00 2001 From: Alan Fitton Date: Sun, 8 Jan 2012 00:52:56 +0000 Subject: fix the performance problems with the torrent add dialog on torrents with many files/dirs. the parent size updates just walks up parents rather than a full foreach, and the inserts try to use the previous update to speed up finding/creating the directories. I'll probably do something similar to the main files treeview. --- src/util.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/util.c') diff --git a/src/util.c b/src/util.c index 7594c46..1251ccb 100644 --- a/src/util.c +++ b/src/util.c @@ -533,3 +533,23 @@ evutil_vsnprintf(char *buf, size_t buflen, const char *format, va_list ap) return r; #endif } + +void iter_to_row_reference(GtkTreeModel * model, GtkTreeIter * iter, + GtkTreeRowReference ** rr) +{ + GtkTreePath *path = gtk_tree_model_get_path(model, iter); + + if (*rr) + gtk_tree_row_reference_free(*rr); + + *rr = gtk_tree_row_reference_new(model, path); + gtk_tree_path_free(path); +} + +void rowref_to_iter(GtkTreeModel * model, GtkTreeRowReference * rr, + GtkTreeIter * iter) +{ + GtkTreePath *path = gtk_tree_row_reference_get_path(rr); + gtk_tree_model_get_iter(model, iter, path); + gtk_tree_path_free(path); +} -- cgit v1.2.3