gtkui: fix O(N^2) algorithm in add_files by recalculating folder state once instead of per-child
gtkui: optimize file dialogs according to pygtk tips

Use a context manager to wrap the common steps:

1) disconnect the treestore from the listview
2) disable treestore sorting
3) add rows (different in add dialog vs files tab)
4) enable treestore sorting
5) connect model to listview