(* Guestfs Browser. * Copyright (C) 2010 Red Hat Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *) (** This is the base class for the file tree. The types and functions in this file should be considered private to the file tree implementation. See {!Filetree} for the full description and public interface. *) (**/**) type t = { view : GTree.view; model : GTree.tree_store; 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; size_col : string GTree.column; date_col : string GTree.column; } (* 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; } (* 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 = | 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 = | Loading (* special "loading ..." node *) | ErrorMessage of string (* error message node *) | Info of string (* information node (eg. disk usage) *) | Top of Slave.source (* top level OS or volume node *) | Directory of Slave.direntry (* a directory *) | File of Slave.direntry (* a file inc. special files *) 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_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 (* 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 markup_of_name : ?visited:bool -> Slave.direntry -> string (* Create markup for filenames. *) val set_visited : t -> Gtk.tree_iter -> unit (* Set a file as visited. *)