X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=main.ml;h=c908bbc9d0ebed9953d55c04e9bc1b1fef64d5f5;hb=2ed92137182d4d479dddddeccaf6ad8dae967895;hp=1fb7ce0a2a9b0b6b7aca5af68e9ef75a807382da;hpb=b9e8c84588873568b7fdfaeb9beb85466e84c8fa;p=guestfs-browser.git diff --git a/main.ml b/main.ml index 1fb7ce0..c908bbc 100644 --- a/main.ml +++ b/main.ml @@ -22,8 +22,7 @@ open Utils (* Main. *) let () = - (* XXX command line *) - Utils.set_verbose_flag (); + let cli_request = Cmdline.command_line () in (* If we're in verbose mode, print some debug information which * could be useful in bug reports. @@ -34,13 +33,53 @@ let () = debug "libvirt %s" (libvirt_version_string ()); ); - let ws = Window.open_main_window () in - Slave.set_failure_hook (Window.failure ws); - Slave.set_busy_hook (Window.throbber_busy ws); - Slave.set_idle_hook (Window.throbber_idle ws); + (* Create the main window. *) + let w = new Window.window in + + (* Wire up hooks that carry messages from the slave thread + * to the main thread. + *) + Slave.set_failure_hook w#failure; + Slave.set_busy_hook w#throbber_busy; + Slave.set_idle_hook w#throbber_idle; + Slave.set_status_hook w#set_statusbar; + Slave.set_progress_hook w#progress; + + (* Wire up the loosely-coupled external components of the filetree. + * See the note about signals in {!Filetree.tree} documentation. + *) + let tree = w#tree in + ignore (tree#op_checksum_file + ~callback:(Op_checksum_file.checksum_file tree)); + ignore (tree#op_copy_regvalue + ~callback:(Op_copy_regvalue.copy_regvalue tree)); + ignore (tree#op_disk_usage + ~callback:(Op_disk_usage.disk_usage tree)); + ignore (tree#op_download_as_reg + ~callback:(Op_download_as_reg.download_as_reg tree)); + ignore (tree#op_download_dir_find0 + ~callback:(Op_download_dir_find0.download_dir_find0 tree)); + ignore (tree#op_download_dir_tarball + ~callback:(Op_download_dir_tarball.download_dir_tarball tree)); + ignore (tree#op_download_file + ~callback:(Op_download_file.download_file tree)); + ignore (tree#op_file_information + ~callback:(Op_file_information.file_information tree)); + ignore (tree#op_inspection_dialog + ~callback:(Op_inspection_dialog.inspection_dialog tree)); + ignore (tree#op_view_file + ~callback:(Op_view_file.view_file tree)); + + (* Connect menu entry signals to the functions that implement them. *) + ignore (w#connect_kvm_signal + ~callback:(w#connect_to (Some "qemu:///system"))); + ignore (w#connect_xen_signal + ~callback:(w#connect_to (Some "xen:///"))); + ignore (w#connect_none_signal + ~callback:(w#connect_to None)); (* What did the user request on the command line? *) - (*Window.run_cli_request ws cli_request;*) + w#run_cli_request cli_request; (* Run the main display thread. When this returns, the application * has been closed.