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 class 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;
48 (* The type of the hidden column used to implement on-demand loading.
49 * All rows are classified as either nodes or leafs (eg. a "node" might
50 * be a directory, or a top-level operating system, or anything else
51 * which the user could open and look inside).
54 | IsLeaf (* there are no children *)
55 | NodeNotStarted (* user has not tried to open this *)
56 | NodeLoading (* user tried to open it, still loading *)
57 | IsNode (* we've loaded the children of this directory *)
59 (* The actual content of a row. *)
61 | Loading (* special "loading ..." node *)
62 | ErrorMessage of string (* error message node *)
63 | Info of string (* information node (eg. disk usage) *)
64 | Top of Slave.source (* top level OS or volume node *)
65 | Directory of Slave.direntry (* a directory *)
66 | File of Slave.direntry (* a file inc. special files *)
68 val store_hdata : t -> Gtk.tree_iter -> hdata -> unit
69 val get_hdata : t -> Gtk.tree_iter -> hdata
70 (* Store/retrieve hdata structure in a model row. *)
72 val find_child_node_by_content : t -> Gtk.tree_iter -> content_t -> Gtk.tree_iter
73 (* [find_child_node_by_content t row content] searches the direct
74 children of [row] looking for one which exactly matches
75 [hdata.content] and returns that child. If no child found,
76 raises [Not_found]. *)
78 val get_pathname : t -> Gtk.tree_iter -> Slave.source * string
79 (* Get the full path to a row by chasing up through the tree to the
80 top. This also returns the source (eg. operating system or single
83 val markup_of_name : ?visited:bool -> Slave.direntry -> string
84 (* Create markup for filenames. *)
86 val set_visited : t -> Gtk.tree_iter -> unit
87 (* Set a file as visited. *)