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 get_pathname : Gtk.tree_iter -> Slave_types.source * string
50 (** Use [get_pathname row] on a [row] representing a file or
51 directory. It searches back up the tree to get the source
52 OS and the full pathname of the file.
54 Don't use this on registry entries. Use {!get_registry_path}
57 method get_registry_path : Gtk.tree_iter -> registry_t * string list
58 (** Use [get_registry_path row] on a [row] representing a registry
59 entry. It searches back up the tree and returns a tuple
62 - an opaque registry handle
64 - list of registry path elements (in reverse order)
66 Don't use this on files and directories. Use {!get_pathname}
69 method get_registry_value : Gtk.tree_iter -> Hivex.hive_type * string
70 (** [get_registry_value row] returns the type and value of the
71 registry value at [row]. *)
73 method get_registry_file : ?fail:exn Slave.callback ->
74 Gtk.tree_path -> registry_t -> string Slave.callback -> unit
75 (** [get_registry_file ?fail path registry_t cb] forces the
76 registry to be downloaded (if not already).
78 [cb cachefile] is called when it is downloaded, where
79 [cachefile] is the local hive containing the registry.
81 Optional argument [?fail] is called if the download fails. *)
83 method set_visited : Gtk.tree_iter -> unit
84 (** Mark row has visited. *)
86 method has_child_info_node : Gtk.tree_path -> string -> bool
87 (** [has_child_info_node path info_text] returns [true] iff there is
88 an info node under path which exactly matches [info_text].
90 Info nodes are used for "Calculating ..." messages, and for
91 the final result of those calculations. *)
93 method set_child_info_node : Gtk.tree_path -> string -> string -> unit
94 (** [set_child_info_node path info_text text] replaces the
95 displayed [text] in the info node [info_text] under [path].
96 If the info node doesn't exist, then one is created. *)
98 (** Signals emitted by the filetree widget.
100 The main point of using signals is to decouple the filetree
101 widget from associated dialogs and operations that can be
102 performed by actions in the context menu. So instead of
103 having a giant filetree object that does everything, we have
104 the code split into small modules, with the filetree widget
105 just emitting signals when some action needs to take place.
107 All the components are wired together in the {!Main}
111 method disconnect : GtkSignal.id -> unit
113 method clear_tree : callback:(unit -> unit) -> GtkSignal.id
114 (** Register a signal handler which is called when the tree is
115 cleared (ie. when either {!clear} or {!add_os} is called. *)
117 (** The following methods register signals that are emitted
118 on user events in the context menu. *)
119 method op_checksum_file :
120 callback:(Gtk.tree_path * string -> unit) -> GtkSignal.id
121 method op_copy_regvalue :
122 callback:(Gtk.tree_path -> unit) -> GtkSignal.id
123 method op_disk_usage :
124 callback:(Gtk.tree_path -> unit) -> GtkSignal.id
125 method op_download_as_reg :
126 callback:(Gtk.tree_path * string -> unit) -> GtkSignal.id
127 method op_download_dir_find0 :
128 callback:(Gtk.tree_path -> unit) -> GtkSignal.id
129 method op_download_dir_tarball :
130 callback:(Slave_types.download_dir_tarball_format * Gtk.tree_path -> unit) ->
132 method op_download_file :
133 callback:(Gtk.tree_path -> unit) -> GtkSignal.id
134 method op_file_information :
135 callback:(Gtk.tree_path -> unit) -> GtkSignal.id
136 method op_inspection_dialog :
137 callback:(Slave_types.inspection_os -> unit) -> GtkSignal.id
138 method op_view_file :
139 callback:(Gtk.tree_path * string -> unit) -> GtkSignal.id