(* 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 module G = Guestfs (* 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; let v = fst (Libvirt.get_version ()) in debug "libvirt %d.%d.%d" (v / 1_000_000) ((v / 1_000) mod 1_000) (v mod 1_000); let g = G.create () in let v = G.version g in debug "libguestfs %Ld.%Ld.%Ld%s" v.G.major v.G.minor v.G.release v.G.extra; G.close g; ); let ds = Window.open_main_window () in Slave.set_failure_hook (Window.failure ds); Slave.set_busy_hook ds.Window.throbber_busy; Slave.set_idle_hook ds.Window.throbber_idle; (* What did the user request on the command line? *) Window.run_cli_request ds cli_request; (* Run the main display thread. When this returns, the application * has been closed. *) GtkThread.main (); Slave.exit_thread ()