18a5187c85792b7909d904cde9cefdf722324238
[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 class 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;
32   index_col : int GTree.column;
33   mode_col : string GTree.column;
34   name_col : string GTree.column;
35   size_col : int64 GTree.column;
36   date_col : string GTree.column;
37   link_col : string GTree.column;
38 }
39
40 and hdata = state_t * content_t
41
42 and state_t =
43   | IsLeaf
44   | NodeNotStarted
45   | NodeLoading
46   | IsNode
47
48 and content_t =
49   | Loading
50   | ErrorMessage of string
51   | Info of string
52   | Top of Slave.source
53   | Directory of Slave.direntry
54   | File of Slave.direntry
55
56 val store_hdata : t -> Gtk.tree_iter -> hdata -> unit
57 val get_hdata : t -> Gtk.tree_iter -> hdata
58   (* Store/retrieve hdata structure in a model row. *)
59
60 val find_child_node_by_hdata : t -> Gtk.tree_iter -> hdata -> Gtk.tree_iter
61   (* [find_child_node_by_hdata t row hdata] searches the direct children
62      of [row] looking for one which exactly matches [hdata] and returns
63      that child.  If no child found, raises [Not_found]. *)
64
65 val get_pathname : t -> Gtk.tree_iter -> Slave.source * string
66   (* Get the full path to a row by chasing up through the tree to the
67      top.  This also returns the source (eg. operating system or single
68      volume). *)