Dir (dirname, content) ->
let subtree = GTree.tree () in
treeitem#set_subtree subtree ;
- List.iter
- (fun ti ->
- let label = get_name ti
- and uri = get_uri ti in
- let treeitem2 = GTree.tree_item ~label:label () in
- subtree#append treeitem2 ;
- ignore(treeitem2#connect#select
- (selection_changed rendering_window uri)) ;
- aux treeitem2 ti
- ) (List.sort compare !content)
+ let expand_sons =
+ List.map
+ (fun ti ->
+ let label = get_name ti
+ and uri = get_uri ti in
+ let treeitem2 = GTree.tree_item ~label:label () in
+ subtree#append treeitem2 ;
+ ignore(treeitem2#connect#select
+ (selection_changed rendering_window uri)) ;
+ (* Almost lazy function *)
+ (fun () -> aux treeitem2 ti)
+ ) (List.sort compare !content)
+ in
+ let lazy_expand_sons = lazy (List.iter (fun f -> f ()) expand_sons) in
+ ignore(treeitem#connect#expand
+ (fun () -> Lazy.force lazy_expand_sons)) ;
| _ -> ()
in
aux