2 * Copyright (C) 2010 Red Hat Inc.
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.
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.
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.
19 (** This is the base module for the file tree.
21 The types and functions in this file should be considered
22 private to the file tree implementation.
24 See {!Filetree} for the full description and public interface. *)
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;
39 (* The internal data we store attached to each row, telling us about
40 * the state of the row and what is in it.
43 mutable state : state_t;
45 mutable visited : bool;
46 mutable hiveh : Hivex.t option;
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).
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 *)
60 (* The actual content of a row. *)
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.source (* top level OS or volume node *)
66 (* top level Windows Registry node *)
67 | TopWinReg of Slave.source * string * string * string
68 | Directory of Slave.direntry (* a directory *)
69 | File of Slave.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) *)
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. *)
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]. *)
83 val get_pathname : t -> Gtk.tree_iter -> Slave.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