configure: Fix perldoc detection.
[guestfs-browser.git] / filetree_type.mli
1 (* Guestfs Browser.
2  * Copyright (C) 2010 Red Hat Inc.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  *)
18
19 (** This is the base module for the file tree.
20
21     The types and functions in this file should be considered
22     private to the file tree implementation.
23
24     See {!Filetree} for the full description and public interface. *)
25
26 (**/**)
27
28 type t = {
29   view : GTree.view;
30   model : GTree.tree_store;
31   hash : (int, hdata) Hashtbl.t;    (* hash from index_col -> hdata *)
32   index_col : int GTree.column;
33   mode_col : string GTree.column;
34   name_col : string GTree.column;
35   size_col : string GTree.column;
36   date_col : string GTree.column;
37 }
38
39 (* The internal data we store attached to each row, telling us about
40  * the state of the row and what is in it.
41  *)
42 and hdata = {
43   mutable state : state_t;
44   content : content_t;
45   mutable visited : bool;
46   mutable hiveh : Hivex.t option;
47 }
48
49 (* The type of the hidden column used to implement on-demand loading.
50  * All rows are classified as either nodes or leafs (eg. a "node" might
51  * be a directory, or a top-level operating system, or anything else
52  * which the user could open and look inside).
53  *)
54 and state_t =
55   | IsLeaf           (* there are no children *)
56   | NodeNotStarted   (* user has not tried to open this *)
57   | NodeLoading      (* user tried to open it, still loading *)
58   | IsNode           (* we've loaded the children of this directory *)
59
60 (* The actual content of a row. *)
61 and content_t =
62   | Loading                          (* special "loading ..." node *)
63   | ErrorMessage of string           (* error message node *)
64   | Info of string                   (* information node (eg. disk usage) *)
65   | Top of Slave_types.source        (* top level OS or volume node *)
66                                      (* top level Windows Registry node *)
67   | TopWinReg of Slave_types.source * string * string * string
68   | Directory of Slave_types.direntry(* a directory *)
69   | File of Slave_types.direntry     (* a file inc. special files *)
70   | RegKey of Hivex.node             (* a registry key (like a dir) *)
71   | RegValue of Hivex.value          (* a registry value (like a file) *)
72
73 val store_hdata : t -> Gtk.tree_iter -> hdata -> unit
74 val get_hdata : t -> Gtk.tree_iter -> hdata
75   (* Store/retrieve hdata structure in a model row. *)
76
77 val find_child_node_by_content : t -> Gtk.tree_iter -> content_t -> Gtk.tree_iter
78   (* [find_child_node_by_content t row content] searches the direct
79      children of [row] looking for one which exactly matches
80      [hdata.content] and returns that child.  If no child found,
81      raises [Not_found]. *)
82
83 val get_pathname : t -> Gtk.tree_iter -> Slave_types.source * string
84   (* Get the full path to a row by chasing up through the tree to the
85      top.  This also returns the source (eg. operating system or single
86      volume). *)
87
88 val get_registry_path : t -> Gtk.tree_iter -> (Slave_types.source * string * string * string) * string list
89   (* Get the path to the top from a registry key.  This returns the
90      pair [(TopWinReg_data, path)] where [TopWinReg_data] is the data
91      inside a {!TopWinReg} node, and [path] is the path (list of node
92      names) up to the top.  You normally need to call {!List.rev} on
93      [path]. *)
94
95 val cache_registry_file : ?fail:exn Slave.callback -> t -> Gtk.tree_path -> Slave_types.source -> string -> string -> unit Slave.callback -> unit
96   (* This is called whenever we need the registry cache file and we
97      can't be sure that it has already been downloaded. *)