X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=filetree.ml;h=7217c4e87757087d2e833fdb0e3bbc97c0cf188d;hb=c21ba5da9a0319c172ef7759dc4771f07d3f72e9;hp=c224a8d968f6980248c0667eac64d26b167347a3;hpb=674ec31578216d728c4ab9c0a8a297e47c81c492;p=guestfs-browser.git diff --git a/filetree.ml b/filetree.ml index c224a8d..7217c4e 100644 --- a/filetree.ml +++ b/filetree.ml @@ -500,6 +500,34 @@ object (self) hdata.state <- IsNode; self#set_visited row + (* Return os(es) in the tree, if any. The root directory of the + * tree looks like this: + * + * \ Top (OS ...) # usually only one, but there can be zero or > 1 + * \ Top (OS ...) + * \ Top (Volume ...) + * \ TopWinReg + * \ TopWinReg + * + * This returns only the Top (OS ...) entries. See also #add_top_level_os + * method. + *) + method oses = + match model#get_iter_first with + | None -> [] + | Some row -> + let rec loop acc = + let acc = + match (self#get_hdata row).content with + | Top (OS os) -> os :: acc + | _ -> acc in + if model#iter_next row then + loop acc + else + List.rev acc + in + loop [] + (* Signals. *) method clear_tree : callback:(unit -> unit) -> GtkSignal.id = clear_tree#connect ~after @@ -629,7 +657,7 @@ object (self) ~callback:(fun () -> op_download_dir_find0#call path)); and add_top_os_items os path = - let item = factory#add_item "Operating system information" in + let item = factory#add_item "Operating system information ..." in ignore (item#connect#activate ~callback:(fun () -> op_inspection_dialog#call os)); ignore (factory#add_separator ());