Version 0.1.7.
[guestfs-browser.git] / filetree_type.mli
index 18a5187..b5c642a 100644 (file)
@@ -16,7 +16,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *)
 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *)
 
-(** This is the base class for the file tree.
+(** This is the base module for the file tree.
 
     The types and functions in this file should be considered
     private to the file tree implementation.
 
     The types and functions in this file should be considered
     private to the file tree implementation.
 type t = {
   view : GTree.view;
   model : GTree.tree_store;
 type t = {
   view : GTree.view;
   model : GTree.tree_store;
-  hash : (int, hdata) Hashtbl.t;
+  hash : (int, hdata) Hashtbl.t;    (* hash from index_col -> hdata *)
   index_col : int GTree.column;
   mode_col : string GTree.column;
   name_col : string GTree.column;
   index_col : int GTree.column;
   mode_col : string GTree.column;
   name_col : string GTree.column;
-  size_col : int64 GTree.column;
+  size_col : string GTree.column;
   date_col : string GTree.column;
   date_col : string GTree.column;
-  link_col : string GTree.column;
 }
 
 }
 
-and hdata = state_t * content_t
+(* The internal data we store attached to each row, telling us about
+ * the state of the row and what is in it.
+ *)
+and hdata = {
+  mutable state : state_t;
+  content : content_t;
+  mutable visited : bool;
+  mutable hiveh : Hivex.t option;
+}
 
 
+(* The type of the hidden column used to implement on-demand loading.
+ * All rows are classified as either nodes or leafs (eg. a "node" might
+ * be a directory, or a top-level operating system, or anything else
+ * which the user could open and look inside).
+ *)
 and state_t =
 and state_t =
-  | IsLeaf
-  | NodeNotStarted
-  | NodeLoading
-  | IsNode
+  | IsLeaf           (* there are no children *)
+  | NodeNotStarted   (* user has not tried to open this *)
+  | NodeLoading      (* user tried to open it, still loading *)
+  | IsNode           (* we've loaded the children of this directory *)
 
 
+(* The actual content of a row. *)
 and content_t =
 and content_t =
-  | Loading
-  | ErrorMessage of string
-  | Info of string
-  | Top of Slave.source
-  | Directory of Slave.direntry
-  | File of Slave.direntry
+  | Loading                          (* special "loading ..." node *)
+  | ErrorMessage of string           (* error message node *)
+  | Info of string                   (* information node (eg. disk usage) *)
+  | Top of Slave_types.source        (* top level OS or volume node *)
+                                     (* top level Windows Registry node *)
+  | TopWinReg of Slave_types.source * string * string * string
+  | Directory of Slave_types.direntry(* a directory *)
+  | File of Slave_types.direntry     (* a file inc. special files *)
+  | RegKey of Hivex.node             (* a registry key (like a dir) *)
+  | RegValue of Hivex.value          (* a registry value (like a file) *)
 
 val store_hdata : t -> Gtk.tree_iter -> hdata -> unit
 val get_hdata : t -> Gtk.tree_iter -> hdata
   (* Store/retrieve hdata structure in a model row. *)
 
 
 val store_hdata : t -> Gtk.tree_iter -> hdata -> unit
 val get_hdata : t -> Gtk.tree_iter -> hdata
   (* Store/retrieve hdata structure in a model row. *)
 
-val find_child_node_by_hdata : t -> Gtk.tree_iter -> hdata -> Gtk.tree_iter
-  (* [find_child_node_by_hdata t row hdata] searches the direct children
-     of [row] looking for one which exactly matches [hdata] and returns
-     that child.  If no child found, raises [Not_found]. *)
+val find_child_node_by_content : t -> Gtk.tree_iter -> content_t -> Gtk.tree_iter
+  (* [find_child_node_by_content t row content] searches the direct
+     children of [row] looking for one which exactly matches
+     [hdata.content] and returns that child.  If no child found,
+     raises [Not_found]. *)
 
 
-val get_pathname : t -> Gtk.tree_iter -> Slave.source * string
+val get_pathname : t -> Gtk.tree_iter -> Slave_types.source * string
   (* Get the full path to a row by chasing up through the tree to the
      top.  This also returns the source (eg. operating system or single
      volume). *)
   (* Get the full path to a row by chasing up through the tree to the
      top.  This also returns the source (eg. operating system or single
      volume). *)
+
+val get_registry_path : t -> Gtk.tree_iter -> (Slave_types.source * string * string * string) * string list
+  (* Get the path to the top from a registry key.  This returns the
+     pair [(TopWinReg_data, path)] where [TopWinReg_data] is the data
+     inside a {!TopWinReg} node, and [path] is the path (list of node
+     names) up to the top.  You normally need to call {!List.rev} on
+     [path]. *)
+
+val cache_registry_file : ?fail:exn Slave.callback -> t -> Gtk.tree_path -> Slave_types.source -> string -> string -> unit Slave.callback -> unit
+  (* This is called whenever we need the registry cache file and we
+     can't be sure that it has already been downloaded. *)