(* 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. *) (** Tree model for displaying files in the guest filesystem. The model reads files and directories on demand so that we don't have to read the whole thing in at the beginning. Originally this was written as a custom tree model, but we couldn't get that to work. Instead we use something similar to this trick: http://mail.gnome.org/archives/gtk-app-devel-list/2003-May/msg00241.html *) type registry_t val source_of_registry_t : registry_t -> Slave_types.source val root_key_of_registry_t : registry_t -> string (** The filetree widget. *) class tree : ?packing:(GObj.widget -> unit) -> unit -> object ('a) inherit GTree.view method clear : unit -> unit (** Clear out all rows in existing widget. *) method add_os : string -> Slave_types.inspection_data -> unit (** [add_os name data] clears out the widget and adds the operating system and/or filesystems described by the [data] struct. The [name] parameter should be some host-side (verifiable) name, not any untrusted string from the guest; usually we pass the name of the guest from libvirt here. *) method oses : Slave_types.inspection_os list (** If operating system root(s) are currently loaded into the filetree widget, this returns a list of them. If none are loaded (empty, or could be just a pile of filesystems), then this returns an empty list. *) method get_pathname : Gtk.tree_iter -> Slave_types.source * string (** Use [get_pathname row] on a [row] representing a file or directory. It searches back up the tree to get the source OS and the full pathname of the file. Don't use this on registry entries. Use {!get_registry_path} instead. *) method get_direntry : Gtk.tree_iter -> Slave_types.direntry (** [get_direntry row] returns the file and stat information for a file or directory. *) method get_registry_path : Gtk.tree_iter -> registry_t * string list (** Use [get_registry_path row] on a [row] representing a registry entry. It searches back up the tree and returns a tuple containing: - an opaque registry handle - list of registry path elements (in reverse order) Don't use this on files and directories. Use {!get_pathname} instead. *) method get_registry_value : Gtk.tree_iter -> Hivex.hive_type * string (** [get_registry_value row] returns the type and value of the registry value at [row]. *) method get_registry_file : ?fail:exn Slave.callback -> Gtk.tree_path -> registry_t -> string Slave.callback -> unit (** [get_registry_file ?fail path registry_t cb] forces the registry to be downloaded (if not already). [cb cachefile] is called when it is downloaded, where [cachefile] is the local hive containing the registry. Optional argument [?fail] is called if the download fails. *) method set_visited : Gtk.tree_iter -> unit (** Mark row has visited. *) method has_child_info_node : Gtk.tree_path -> string -> bool (** [has_child_info_node path info_text] returns [true] iff there is an info node under path which exactly matches [info_text]. Info nodes are used for "Calculating ..." messages, and for the final result of those calculations. *) method set_child_info_node : Gtk.tree_path -> string -> string -> unit (** [set_child_info_node path info_text text] replaces the displayed [text] in the info node [info_text] under [path]. If the info node doesn't exist, then one is created. *) (** Signals emitted by the filetree widget. The main point of using signals is to decouple the filetree widget from associated dialogs and operations that can be performed by actions in the context menu. So instead of having a giant filetree object that does everything, we have the code split into small modules, with the filetree widget just emitting signals when some action needs to take place. All the components are wired together in the {!Main} module. *) method after : 'a method disconnect : GtkSignal.id -> unit method clear_tree : callback:(unit -> unit) -> GtkSignal.id (** Register a signal handler which is called when the tree is cleared (ie. when either {!clear} or {!add_os} is called. *) (** The following methods register signals that are emitted on user events in the context menu. *) method op_checksum_file : callback:(Gtk.tree_path * string -> unit) -> GtkSignal.id method op_copy_regvalue : callback:(Gtk.tree_path -> unit) -> GtkSignal.id method op_disk_usage : callback:(Gtk.tree_path -> unit) -> GtkSignal.id method op_download_as_reg : callback:(Gtk.tree_path * string -> unit) -> GtkSignal.id method op_download_dir_find0 : callback:(Gtk.tree_path -> unit) -> GtkSignal.id method op_download_dir_tarball : callback:(Slave_types.download_dir_tarball_format * Gtk.tree_path -> unit) -> GtkSignal.id method op_download_file : callback:(Gtk.tree_path -> unit) -> GtkSignal.id method op_file_information : callback:(Gtk.tree_path -> unit) -> GtkSignal.id method op_file_properties : callback:(Gtk.tree_path -> unit) -> GtkSignal.id method op_inspection_dialog : callback:(Slave_types.inspection_os -> unit) -> GtkSignal.id method op_view_file : callback:(Gtk.tree_path * string -> unit) -> GtkSignal.id end