From 4e1bc40b1d12427dbd8e3c749fba7aa9ab1797b9 Mon Sep 17 00:00:00 2001 From: Claudio Sacerdoti Coen Date: Wed, 20 Dec 2000 17:45:01 +0000 Subject: [PATCH] Now the gtk trees are lazily constructed. --- helm/interface/mmlinterface.ml | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) 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 -- 2.39.2