Add status bar, progress bar, command line.
[virt-resize-ui.git] / source_tab.ml
index f791e80..797ba4a 100644 (file)
@@ -68,36 +68,54 @@ object (self)
   method private opened inspection_data =
     (* We expect that there are some filesystems in the image,
        otherwise fail. *)
-    if inspection_data.insp_all_filesystems = [] then
-      inspection.inspection_label#set_text
-        "error: no filesystems were found in the selected disk image or guest"
+    let nr_filesystems = List.length inspection_data.insp_all_filesystems in
+    if nr_filesystems = 0 then
+      inspection.inspection_label#set_label
+        "<b>error: no filesystems were found in the selected disk image or guest</b>"
     else (
       (match inspection_data.insp_oses with
       | [] ->                           (* no OS, but there were filesystems *)
-        inspection.inspection_label#set_text
-          "warning: no operating systems were recognized in this disk image or guest"
-
-      | [ os ] ->
-        let label =
-          sprintf "%s %s %d.%d"
-            os.insp_type os.insp_distro
-            os.insp_major_version os.insp_minor_version in
-        let label =
-          if os.insp_product_name <> "" then
-            label ^ " (" ^ os.insp_product_name ^ ")"
+        let markup =
+          sprintf "%d filesystem(s) found\n<b>warning: no operating systems were recognized in this disk image or guest</b>"
+            nr_filesystems in
+        inspection.inspection_label#set_label markup
+
+      | os :: oses ->
+        let markup =
+          if os.insp_product_name = "" then
+            sprintf "%s %s %d.%d\n"
+              os.insp_type os.insp_distro
+              os.insp_major_version os.insp_minor_version
           else
-            label in
-        inspection.inspection_label#set_text label
+            sprintf "%s\n" (markup_escape os.insp_product_name) in
+        let markup =
+          markup ^ sprintf "with %d filesystem(s)\n" nr_filesystems in
 
-      | _ ->
-        inspection.inspection_label#set_text
-          "warning: resizing multi-boot virtual machines may not be successful"
+        let markup =
+          if oses <> [] then
+            markup ^ "<b>warning: resizing multi-boot virtual machines may not be successful</b>"
+          else markup in
+
+        inspection.inspection_label#set_label markup
       );
 
       (* Raise the ready signal. *)
       ready_signal#call ()
     )
 
+  method run_cli_request = function
+  | Cmdline.Empty_window -> ()
+  | Cmdline.Open_images images ->
+    let msg = Slave.Open_images (images, self#opened) in
+    Slave.send_message msg
+  | Cmdline.Open_guest guest ->
+(*
+      (* Open libvirt connection, and in the callback open the guest. *)
+      let uri = connect_uri () in
+      Slave.connect uri (self#when_connected_cli_request guest)
+*)
+    assert false (* XXX not implemented *)
+
   initializer
     (* Set the inputs to be sensitive according to the state of the
        top level radio buttons. *)
@@ -206,6 +224,7 @@ let tab () =
 
   let inspection =
     let label = GMisc.label ~packing:(tbl#attach ~top:7 ~left:0 ~right:2) () in
+    label#set_use_markup true;
     { inspection_label = label } in
 
   (* Return the object. *)