]> matita.cs.unibo.it Git - helm.git/commitdiff
Now the gtk trees are lazily constructed.
authorClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Wed, 20 Dec 2000 17:45:01 +0000 (17:45 +0000)
committerClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Wed, 20 Dec 2000 17:45:01 +0000 (17:45 +0000)
helm/interface/mmlinterface.ml

index a50555fd8a8b6fdcb2f76cb115d2dd1d4d80bfa0..2688fc1befcb86fdb90fd1e270dfa2fe84a4a85a 100755 (executable)
@@ -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