dlg#destroy ();
(* Download the file. *)
- Slave.download_file src pathname localfile Slave.no_callback
+ Slave.download_file src pathname localfile
+ (when_downloaded_file t path)
+
+and when_downloaded_file ({ model = model } as t) path () =
+ let row = model#get_iter path in
+ set_visited t row
(* Download a directory as a tarball. *)
let rec download_dir_tarball ({ model = model } as t) format path () =
(* Download the directory. *)
Slave.download_dir_tarball src pathname format localfile
- Slave.no_callback
+ (when_downloaded_dir_tarball t path)
+
+and when_downloaded_dir_tarball ({ model = model } as t) path () =
+ let row = model#get_iter path in
+ set_visited t row
let rec download_dir_find0 ({ model = model } as t) path () =
let row = model#get_iter path in
dlg#destroy ();
(* Download the directory. *)
- Slave.download_dir_find0 src pathname localfile Slave.no_callback
+ Slave.download_dir_find0 src pathname localfile
+ (when_downloaded_dir_find0 t path)
+
+and when_downloaded_dir_find0 ({ model = model } as t) path () =
+ let row = model#get_iter path in
+ set_visited t row
-let has_child_node_equals t row hdata =
- try ignore (find_child_node_by_hdata t row hdata); true
+let has_child_node_equals t row content =
+ try ignore (find_child_node_by_content t row content); true
with Not_found -> false
(* Calculate disk space used by a directory. *)
(* See if this node already has an Info "disk_usage" child node. If
* so they don't recreate it.
*)
- let hdata = IsLeaf, Info "disk_usage" in
- if not (has_child_node_equals t row hdata) then (
+ let content = Info "disk_usage" in
+ if not (has_child_node_equals t row content) then (
(* Create the child node first. *)
let row = model#insert ~parent:row 0 in
- store_hdata t row hdata;
+ store_hdata t row { state=IsLeaf; content=content; visited=false };
model#set ~row ~column:t.name_col "<i>Calculating disk usage ...</i>";
- Slave.disk_usage src pathname (when_disk_usage t path)
+ Slave.disk_usage src pathname (when_disk_usage t path pathname)
)
-and when_disk_usage ({ model = model } as t) path kbytes =
+and when_disk_usage ({ model = model } as t) path pathname kbytes =
let row = model#get_iter path in
(* Find the Info "disk_usage" child node add above, and replace the
* text in it with the final size.
*)
try
- let hdata = IsLeaf, Info "disk_usage" in
- let row = find_child_node_by_hdata t row hdata in
- let msg = sprintf "<b>Disk usage: %Ld KB</b>" kbytes in
+ let content = Info "disk_usage" in
+ let row = find_child_node_by_content t row content in
+ let msg =
+ sprintf "<b>%s</b>\n<small>Disk usage of %s (%Ld KB)</small>"
+ (human_size_1k kbytes) pathname kbytes in
model#set ~row ~column:t.name_col msg
with
Not_found -> ()
+
+(* Display operating system inspection information. *)
+let display_inspection_data ({ model = model } as t) path () =
+ t.view#expand_row path;
+
+ let row = model#get_iter path in
+ let src, _ = get_pathname t row in
+ debug "display_inspection_data";
+
+ (* Should be an OS source, if not ignore. *)
+ match src with
+ | Slave.Volume _ -> ()
+ | Slave.OS os ->
+ (* See if this node already has an Info "inspection_data" child
+ * node. If so they don't recreate it.
+ *)
+ let content = Info "inspection_data" in
+ if not (has_child_node_equals t row content) then (
+ let row = model#insert ~parent:row 0 in
+ store_hdata t row { state=IsLeaf; content=content; visited=false };
+
+ (* XXX UGHLEE *)
+ let data =
+ sprintf "Type: <b>%s</b>\nDistro: <b>%s</b>\nVersion: <b>%d.%d</b>\nArch.: <b>%s</b>\nPackaging: <b>%s</b>/<b>%s</b>\n%sMountpoints:\n%s"
+ os.Slave.insp_type os.Slave.insp_distro
+ os.Slave.insp_major_version os.Slave.insp_minor_version
+ os.Slave.insp_arch
+ os.Slave.insp_package_management os.Slave.insp_package_format
+ (match os.Slave.insp_windows_systemroot with
+ | None -> ""
+ | Some path ->
+ sprintf "%%systemroot%%: <b>%s</b>\n" (markup_escape path))
+ (String.concat "\n"
+ (List.map (
+ fun (mp, dev) ->
+ sprintf "<b>%s</b> on <b>%s</b>"
+ (markup_escape dev) (markup_escape mp))
+ os.Slave.insp_mountpoints)
+ ) in
+
+ model#set ~row ~column:t.name_col data
+ )