cd047cc207be78d11b371291b41beade5185583f
[guestfs-browser.git] / filetree.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 (** Tree model for displaying files in the guest filesystem.
20
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.
23
24     Originally this was written as a custom tree model, but we
25     couldn't get that to work.  Instead we use something similar
26     to this trick:
27     http://mail.gnome.org/archives/gtk-app-devel-list/2003-May/msg00241.html *)
28
29 type t
30   (** A filetree widget.  Actually an opaque object which contains the
31       widget and other data.  Use the accessors below. *)
32
33 val create : ?status:(string -> unit) -> packing:(GObj.widget -> unit) -> unit -> t
34   (** Create a new filetree widget (empty).
35
36       In the optional [?status] parameter you can pass in some
37       function that updates a status bar.  This function will be
38       called by the filetree whenever the user should be told about
39       some ordinary event having happened (for example, that a file is
40       being downloaded or has finished downloading).
41
42       [~packing] is the required packing for the widget. *)
43
44 val clear : t -> unit
45   (** Clear out all rows in existing widget. *)
46
47 val add : t -> string -> Slave.inspection_data -> unit
48   (** [add t name data] clears out the widget and adds the operating
49       system and/or filesystems described by the [data] struct.  The
50       [name] parameter should be some host-side (verifiable) name;
51       usually we pass the name of the guest from libvirt here. *)
52
53 val set_status_fn : t -> (string -> unit) -> unit
54   (** Set or update the [status] function. *)