]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/matita/matitaMathView.ml
added icons to entries shown in cicbrowser so that directories are
[helm.git] / helm / matita / matitaMathView.ml
index 0a2e8f90df37fbb5b2423e782333086cf209ec68..dc90df9db6ed7cfcf27d52f375f924ada3a9cd08 100644 (file)
@@ -322,6 +322,10 @@ class cicBrowser_impl ~(history:MatitaTypes.mathViewer_entry MatitaMisc.history)
     ignore (MatitaGtkMisc.ask_confirmation ~gui:(MatitaGui.instance ())
       ~title:"Cic browser" ~msg ~cancel:false ());
   in
+  let tags =
+    [ "dir", GdkPixbuf.from_file (MatitaMisc.image_path "matita-folder.png");
+      "obj", GdkPixbuf.from_file (MatitaMisc.image_path "matita-object.png") ]
+  in
   let handle_error f =
     try
       f ()
@@ -399,7 +403,9 @@ class cicBrowser_impl ~(history:MatitaTypes.mathViewer_entry MatitaMisc.history)
     val mutable current_infos = None
     val mutable current_mathml = None
 
-    val model = new MatitaGtkMisc.stringListModel win#whelpResultTreeview
+(*     val model = new MatitaGtkMisc.stringListModel win#whelpResultTreeview *)
+    val model =
+      new MatitaGtkMisc.taggedStringListModel tags win#whelpResultTreeview
 
     method private _getWhelpResultTreeviewSelection () =
       match model#easy_selection () with
@@ -465,7 +471,7 @@ class cicBrowser_impl ~(history:MatitaTypes.mathViewer_entry MatitaMisc.history)
             | `Uri uri -> self#_loadUriManagerUri (UriManager.uri_of_string uri)
             | `Whelp (query, results) -> 
                 set_whelp_query query;
-                self#_loadList results);
+                self#_loadList (List.map (fun r -> "dir", r) results));
             self#setEntry entry
           end
       with
@@ -505,8 +511,8 @@ class cicBrowser_impl ~(history:MatitaTypes.mathViewer_entry MatitaMisc.history)
     method private _loadDir dir = 
       let content = Http_getter.ls dir in
       let l = List.map (function 
-        | Http_getter_types.Ls_section sec -> sec            
-        | Http_getter_types.Ls_object obj -> obj.Http_getter_types.uri
+        | Http_getter_types.Ls_section sec -> "dir", sec
+        | Http_getter_types.Ls_object obj -> "obj", obj.Http_getter_types.uri
         ) content
       in
       self#_loadList l
@@ -545,7 +551,7 @@ class cicBrowser_impl ~(history:MatitaTypes.mathViewer_entry MatitaMisc.history)
 
     method private _loadList l =
       model#list_store#clear ();
-      List.iter model#easy_append l;
+      List.iter (fun (tag, s) -> model#easy_append ~tag s) l;
       self#_showList
     
     (** { public methods, all must call _load!! } *)