[#2670] [GTKUI] addtorrentdialog: fix O(N^2) algorithm in add_files by recalculating folder state once instead of per-child

This commit is contained in:
Ryan Hitchman 2014-11-01 23:58:09 -07:00 committed by Calum Lind
parent 8d3ba87c63
commit ea028c7531
1 changed files with 20 additions and 22 deletions

View File

@ -313,7 +313,7 @@ class AddTorrentDialog(component.Component):
value[2], key, value[1]["size"], value[2], key, value[1]["size"],
value[0], False, gtk.STOCK_FILE value[0], False, gtk.STOCK_FILE
]) ])
ret += value[1]["size"]
if parent_iter and self.files_treestore.iter_has_child(parent_iter): if parent_iter and self.files_treestore.iter_has_child(parent_iter):
# Iterate through the children and see what we should label the # Iterate through the children and see what we should label the
# folder, download true, download false or inconsistent. # folder, download true, download false or inconsistent.
@ -334,8 +334,6 @@ class AddTorrentDialog(component.Component):
self.files_treestore.set_value(parent_iter, 0, download_value) self.files_treestore.set_value(parent_iter, 0, download_value)
self.files_treestore.set_value(parent_iter, 4, inconsistent) self.files_treestore.set_value(parent_iter, 4, inconsistent)
ret += value[1]["size"]
return ret return ret
def load_path_choosers_data(self): def load_path_choosers_data(self):