files: optimization to avoid o(n^2) iteration

This commit is contained in:
Ignacio Casal Quinteiro 2013-02-16 14:49:21 +01:00
parent 827a5e9110
commit 04249d8fbe

View file

@ -167,20 +167,25 @@ public class TreeStore : Gtk.TreeStore
});
} catch (Error e) { }
if (items == null)
{
return;
}
items.reverse();
unowned List<Item?>? i = items;
var paths = new HashTable<string, Gtk.TreePath>(str_hash, str_equal);
var i = 0;
d_update_id = Idle.add(() => {
Item? item = items.nth_data(i);
i++;
if (item == null)
if (i == null)
{
d_update_id = 0;
return false;
}
Item item = i.data;
i = i.next;
var root = item.root;
var entry = item.entry;
var isdir = entry.get_file_mode() == Ggit.FileMode.TREE;