Add file properties dialog.
[guestfs-browser.git] / slave.ml
index 975ab35..360a11c 100644 (file)
--- a/slave.ml
+++ b/slave.ml
@@ -47,6 +47,7 @@ type command =
   | Download_dir_tarball of source * string * download_dir_tarball_format * string * unit callback
   | Download_file of source * string * string * bool * unit callback
   | File_information of source * string * string callback
+  | File_xattrs of source * string * G.xattr array callback
   | List_applications of inspection_os * G.application array callback
   | Open_domain of string * inspection_data callback
   | Open_images of (string * string option) list * inspection_data callback
@@ -75,6 +76,8 @@ let rec string_of_command = function
         (string_of_source src) remotefile localfile check
   | File_information (src, pathname, _) ->
       sprintf "File_information (%s, %s)" (string_of_source src) pathname
+  | File_xattrs (src, pathname, _) ->
+      sprintf "File_xattrs (%s, %s)" (string_of_source src) pathname
   | List_applications (os, _) ->
       sprintf "List_applications %s" os.insp_root
   | Open_domain (name, _) -> sprintf "Open_domain %s" name
@@ -171,6 +174,8 @@ let download_file_if_not_exist ?fail src remotefile localfile cb =
   send_to_slave ?fail (Download_file (src, remotefile, localfile, true, cb))
 let file_information ?fail src pathname cb =
   send_to_slave ?fail (File_information (src, pathname, cb))
+let file_xattrs ?fail src pathname cb =
+  send_to_slave ?fail (File_xattrs (src, pathname, cb))
 let list_applications ?fail os cb =
   send_to_slave ?fail (List_applications (os, cb))
 let open_domain ?fail name cb = send_to_slave ?fail (Open_domain (name, cb))
@@ -353,6 +358,19 @@ and execute_command = function
       status "Finished calculating file information for %s" pathname;
       callback_if_not_discarded cb r
 
+  | File_xattrs (src, pathname, cb) ->
+      status "Getting file xattrs for %s ..." pathname;
+
+      let g = get_g () in
+      let r =
+        with_mount_ro g src (
+          fun () ->
+            g#getxattrs pathname
+        ) in
+
+      status "Finished calculating file information for %s" pathname;
+      callback_if_not_discarded cb r
+
   | List_applications (os, cb) ->
       status "Listing applications ...";