Version 0.1.3.
[guestfs-browser.git] / filetree_ops.ml
index 93ecb62..801f50a 100644 (file)
@@ -19,8 +19,8 @@
 open Printf
 
 open Utils
-
 open Filetree_type
+open Filetree_markup
 
 (* Get the basename of a file, using path conventions which are valid
  * for libguestfs.  So [Filename.basename] won't necessarily work
@@ -160,7 +160,8 @@ let rec disk_usage ({ model = model } as t) path () =
   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 { state=IsLeaf; content=content; visited=false };
+    let hdata = { state=IsLeaf; content=content; visited=false; hiveh=None } in
+    store_hdata t row hdata;
     model#set ~row ~column:t.name_col "<i>Calculating disk usage ...</i>";
 
     Slave.disk_usage src pathname (when_disk_usage t path pathname)
@@ -200,7 +201,9 @@ let display_inspection_data ({ model = model } as t) path () =
       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 };
+        let hdata =
+          { state=IsLeaf; content=content; visited=false; hiveh=None } in
+        store_hdata t row hdata;
 
         (* XXX UGHLEE *)
         let data =
@@ -223,3 +226,16 @@ let display_inspection_data ({ model = model } as t) path () =
 
         model#set ~row ~column:t.name_col data
       )
+
+(* Copy registry key value to clipboard. *)
+let copy_regvalue ({ model = model } as t) path () =
+  let row = model#get_iter path in
+  let hdata = get_hdata t row in
+  match hdata with
+  | { content=RegValue value; hiveh = Some h } ->
+      let t, v = Hivex.value_value h value in
+      let v = printable_hivex_value t v in
+      let cb = GData.clipboard Gdk.Atom.clipboard in
+      cb#set_text v
+
+  | _ -> () (* not a registry value row, ignore *)