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 (** Tree model for displaying files in the guest filesystem.
21 The model reads files and directories on demand so that we don't
22 have to read the whole thing in at the beginning.
24 Originally this was written as a custom tree model, but we
25 couldn't get that to work. Instead we use something similar
27 http://mail.gnome.org/archives/gtk-app-devel-list/2003-May/msg00241.html *)
30 val source_of_registry_t : registry_t -> Slave_types.source
31 val root_key_of_registry_t : registry_t -> string
33 (** The filetree widget. *)
34 class tree : ?packing:(GObj.widget -> unit) -> unit ->
38 method clear : unit -> unit
39 (** Clear out all rows in existing widget. *)
41 method add_os : string -> Slave_types.inspection_data -> unit
42 (** [add_os name data] clears out the widget and adds the operating
43 system and/or filesystems described by the [data] struct.
45 The [name] parameter should be some host-side (verifiable) name,
46 not any untrusted string from the guest; usually we pass the
47 name of the guest from libvirt here. *)
49 method oses : Slave_types.inspection_os list
50 (** If operating system root(s) are currently loaded into the
51 filetree widget, this returns a list of them. If none are
52 loaded (empty, or could be just a pile of filesystems), then this
53 returns an empty list. *)
55 method get_pathname : Gtk.tree_iter -> Slave_types.source * string
56 (** Use [get_pathname row] on a [row] representing a file or
57 directory. It searches back up the tree to get the source
58 OS and the full pathname of the file.
60 Don't use this on registry entries. Use {!get_registry_path}
63 method get_registry_path : Gtk.tree_iter -> registry_t * string list
64 (** Use [get_registry_path row] on a [row] representing a registry
65 entry. It searches back up the tree and returns a tuple
68 - an opaque registry handle
70 - list of registry path elements (in reverse order)
72 Don't use this on files and directories. Use {!get_pathname}
75 method get_registry_value : Gtk.tree_iter -> Hivex.hive_type * string
76 (** [get_registry_value row] returns the type and value of the
77 registry value at [row]. *)
79 method get_registry_file : ?fail:exn Slave.callback ->
80 Gtk.tree_path -> registry_t -> string Slave.callback -> unit
81 (** [get_registry_file ?fail path registry_t cb] forces the
82 registry to be downloaded (if not already).
84 [cb cachefile] is called when it is downloaded, where
85 [cachefile] is the local hive containing the registry.
87 Optional argument [?fail] is called if the download fails. *)
89 method set_visited : Gtk.tree_iter -> unit
90 (** Mark row has visited. *)
92 method has_child_info_node : Gtk.tree_path -> string -> bool
93 (** [has_child_info_node path info_text] returns [true] iff there is
94 an info node under path which exactly matches [info_text].
96 Info nodes are used for "Calculating ..." messages, and for
97 the final result of those calculations. *)
99 method set_child_info_node : Gtk.tree_path -> string -> string -> unit
100 (** [set_child_info_node path info_text text] replaces the
101 displayed [text] in the info node [info_text] under [path].
102 If the info node doesn't exist, then one is created. *)
104 (** Signals emitted by the filetree widget.
106 The main point of using signals is to decouple the filetree
107 widget from associated dialogs and operations that can be
108 performed by actions in the context menu. So instead of
109 having a giant filetree object that does everything, we have
110 the code split into small modules, with the filetree widget
111 just emitting signals when some action needs to take place.
113 All the components are wired together in the {!Main}
117 method disconnect : GtkSignal.id -> unit
119 method clear_tree : callback:(unit -> unit) -> GtkSignal.id
120 (** Register a signal handler which is called when the tree is
121 cleared (ie. when either {!clear} or {!add_os} is called. *)
123 (** The following methods register signals that are emitted
124 on user events in the context menu. *)
125 method op_checksum_file :
126 callback:(Gtk.tree_path * string -> unit) -> GtkSignal.id
127 method op_copy_regvalue :
128 callback:(Gtk.tree_path -> unit) -> GtkSignal.id
129 method op_disk_usage :
130 callback:(Gtk.tree_path -> unit) -> GtkSignal.id
131 method op_download_as_reg :
132 callback:(Gtk.tree_path * string -> unit) -> GtkSignal.id
133 method op_download_dir_find0 :
134 callback:(Gtk.tree_path -> unit) -> GtkSignal.id
135 method op_download_dir_tarball :
136 callback:(Slave_types.download_dir_tarball_format * Gtk.tree_path -> unit) ->
138 method op_download_file :
139 callback:(Gtk.tree_path -> unit) -> GtkSignal.id
140 method op_file_information :
141 callback:(Gtk.tree_path -> unit) -> GtkSignal.id
142 method op_inspection_dialog :
143 callback:(Slave_types.inspection_os -> unit) -> GtkSignal.id
144 method op_view_file :
145 callback:(Gtk.tree_path * string -> unit) -> GtkSignal.id