From: Claudio Sacerdoti Coen Date: Wed, 20 Dec 2000 17:45:01 +0000 (+0000) Subject: Now the gtk trees are lazily constructed. X-Git-Tag: nogzip~78 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=4e1bc40b1d12427dbd8e3c749fba7aa9ab1797b9;p=helm.git Now the gtk trees are lazily constructed. --- diff --git a/helm/interface/mmlinterface.ml b/helm/interface/mmlinterface.ml index a50555fd8..2688fc1be 100755 --- a/helm/interface/mmlinterface.ml +++ b/helm/interface/mmlinterface.ml @@ -397,16 +397,22 @@ let mktree selection_changed rendering_window = 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