(* Guestfs Browser. * Copyright (C) 2010 Red Hat Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *) open Printf open Utils (* Main. *) let () = let cli_request = Cmdline.command_line () in (* If we're in verbose mode, print some debug information which * could be useful in bug reports. *) if verbose () then ( debug "%s %s" Config.package Config.version; debug "libguestfs %s" (libguestfs_version_string ()); debug "libvirt %s" (libvirt_version_string ()); ); (* 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_file_properties ~callback:(Op_file_properties.file_properties 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)); ignore (w#connect_uri_signal ~callback:(Menu_open_uri.open_uri_dialog w)); ignore (w#open_disk_signal ~callback:(Menu_open_disk.open_disk_dialog w)); ignore (w#reopen_signal ~callback:w#reopen); ignore ( w#inspection_signal ~callback:( fun () -> match tree#oses with | [] -> () | os :: _ -> (* Note the menu entry only shows data for the first OS, (for multiboot). *) Op_inspection_dialog.inspection_dialog tree os ) ); ignore (w#about_signal ~callback:(Menu_about.open_about_dialog w)); (* What did the user request on the command line? *) w#run_cli_request cli_request; (* Run the main display thread. When this returns, the application * has been closed. *) GtkThread.main (); Slave.exit_thread ()