vc_domain_ops.cmi: vc_connections.cmi
vc_helpers.cmi: ../libvirt/libvirt.cmi
vc_mainwindow.cmi: vc_domain_ops.cmi
-vc_connection_dlg.cmo: vc_connections.cmi vc_connection_dlg.cmi
-vc_connection_dlg.cmx: vc_connections.cmx vc_connection_dlg.cmi
-vc_connections.cmo: vc_helpers.cmi ../libvirt/libvirt.cmi vc_connections.cmi
-vc_connections.cmx: vc_helpers.cmx ../libvirt/libvirt.cmx vc_connections.cmi
-vc_dbus.cmo: vc_connection_dlg.cmi vc_dbus.cmi
-vc_dbus.cmx: vc_connection_dlg.cmx vc_dbus.cmi
-vc_domain_ops.cmo: vc_connections.cmi ../libvirt/libvirt.cmi \
- vc_domain_ops.cmi
-vc_domain_ops.cmx: vc_connections.cmx ../libvirt/libvirt.cmx \
- vc_domain_ops.cmi
-vc_helpers.cmo: ../libvirt/libvirt.cmi vc_helpers.cmi
-vc_helpers.cmx: ../libvirt/libvirt.cmx vc_helpers.cmi
+vc_connection_dlg.cmo: virt_ctrl_gettext.cmo vc_connections.cmi \
+ vc_connection_dlg.cmi
+vc_connection_dlg.cmx: virt_ctrl_gettext.cmx vc_connections.cmx \
+ vc_connection_dlg.cmi
+vc_connections.cmo: virt_ctrl_gettext.cmo vc_helpers.cmi \
+ ../libvirt/libvirt.cmi vc_connections.cmi
+vc_connections.cmx: virt_ctrl_gettext.cmx vc_helpers.cmx \
+ ../libvirt/libvirt.cmx vc_connections.cmi
+vc_dbus.cmo: virt_ctrl_gettext.cmo vc_connection_dlg.cmi vc_dbus.cmi
+vc_dbus.cmx: virt_ctrl_gettext.cmx vc_connection_dlg.cmx vc_dbus.cmi
+vc_domain_ops.cmo: virt_ctrl_gettext.cmo vc_connections.cmi \
+ ../libvirt/libvirt.cmi vc_domain_ops.cmi
+vc_domain_ops.cmx: virt_ctrl_gettext.cmx vc_connections.cmx \
+ ../libvirt/libvirt.cmx vc_domain_ops.cmi
+vc_helpers.cmo: virt_ctrl_gettext.cmo ../libvirt/libvirt.cmi vc_helpers.cmi
+vc_helpers.cmx: virt_ctrl_gettext.cmx ../libvirt/libvirt.cmx vc_helpers.cmi
vc_icons.cmo: vc_connection_dlg.cmi
vc_icons.cmx: vc_connection_dlg.cmx
-vc_mainwindow.cmo: vc_connections.cmi vc_connection_dlg.cmi \
- ../libvirt/libvirt.cmi vc_mainwindow.cmi
-vc_mainwindow.cmx: vc_connections.cmx vc_connection_dlg.cmx \
- ../libvirt/libvirt.cmx vc_mainwindow.cmi
-virt_ctrl.cmo: vc_mainwindow.cmi vc_domain_ops.cmi
-virt_ctrl.cmx: vc_mainwindow.cmx vc_domain_ops.cmx
+vc_mainwindow.cmo: virt_ctrl_gettext.cmo vc_connections.cmi \
+ vc_connection_dlg.cmi ../libvirt/libvirt.cmi vc_mainwindow.cmi
+vc_mainwindow.cmx: virt_ctrl_gettext.cmx vc_connections.cmx \
+ vc_connection_dlg.cmx ../libvirt/libvirt.cmx vc_mainwindow.cmi
+virt_ctrl.cmo: virt_ctrl_gettext.cmo vc_mainwindow.cmi vc_domain_ops.cmi
+virt_ctrl.cmx: virt_ctrl_gettext.cmx vc_mainwindow.cmx vc_domain_ops.cmx
HAVE_GDK_PIXBUF_MLSOURCE = @HAVE_GDK_PIXBUF_MLSOURCE@
pkg_dbus = @pkg_dbus@
+pkg_gettext = @pkg_gettext@
OCAMLFIND = @OCAMLFIND@
-OBJS += \
+ifneq ($(pkg_gettext),no)
+OBJS := virt_ctrl_gettext.cmo
+endif
+
+OBJS += \
vc_helpers.cmo \
vc_connections.cmo \
vc_domain_ops.cmo \
# Good, we have ocamlfind.
OCAMLCPACKAGES := -I ../libvirt -package unix,lablgtk2
ifeq ($(pkg_dbus),yes)
-OCAMLCPACKAGES := $(OCAMLCPACKAGES),dbus
+OCAMLCPACKAGES += -package dbus
OBJS += vc_dbus.cmo
endif
+ifeq ($(pkg_gettext),yes)
+OCAMLCPACKAGES += -package gettext-stub
+endif
OCAMLCFLAGS := -g
OCAMLCLIBS := -linkpkg
OCAMLOPTPACKAGES := $(OCAMLCPACKAGES)
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*)
+open Virt_ctrl_gettext.Gettext
+
type name = string
type uri = string
type service = name * uri
(* Open connection dialog. *)
let open_connection parent () =
- let title = "Open connection to hypervisor" in
+ let title = s_ "Open connection to hypervisor" in
let position = `CENTER_ON_PARENT in
let dlg = GWindow.dialog ~title ~position ~parent
(* Local connections. *)
let () =
let frame =
- GBin.frame ~label:"This machine" ~packing:vbox#pack () in
+ GBin.frame ~label:(s_ "This machine") ~packing:vbox#pack () in
let hbox = GPack.hbox ~packing:frame#add () in
hbox#set_spacing 20;
ignore (
vbox#set_spacing 5;
let xen_button =
- GButton.button ~label:"Xen hypervisor"
+ GButton.button ~label:(s_ "Xen hypervisor")
~packing:vbox#pack () in
ignore (xen_button#connect#clicked
~callback:(fun () ->
uri := Some local_xen_uri;
dlg#destroy ()));
let qemu_button =
- GButton.button ~label:"QEMU or KVM"
+ GButton.button ~label:(s_ "QEMU or KVM")
~packing:vbox#pack () in
ignore (qemu_button#connect#clicked
~callback:(fun () ->
(* Network connections. *)
let () =
let frame =
- GBin.frame ~label:"Local network"
+ GBin.frame ~label:(s_ "Local network")
~packing:(vbox#pack ~expand:true) () in
let hbox = GPack.hbox ~packing:frame#add () in
hbox#set_spacing 20;
let hbox = GPack.hbox ~packing:vbox#pack () in
let refresh_button =
- GButton.button ~label:"Refresh" ~stock:`REFRESH ~packing:hbox#pack () in
+ GButton.button ~label:(s_ "Refresh")
+ ~stock:`REFRESH ~packing:hbox#pack () in
let open_button =
- GButton.button ~label:"Open" ~packing:hbox#pack () in
+ GButton.button ~label:(s_ "Open") ~packing:hbox#pack () in
ignore (refresh_button#connect#clicked ~callback:refresh);
(* Custom connections. *)
let () =
let frame =
- GBin.frame ~label:"URI connection" ~packing:vbox#pack () in
+ GBin.frame ~label:(s_ "URI connection") ~packing:vbox#pack () in
let hbox = GPack.hbox ~packing:frame#add () in
hbox#set_spacing 20;
ignore (GMisc.image ~stock:`CONNECT ~packing:hbox#pack ());
GEdit.entry ~text:"xen://localhost/"
~packing:(hbox#pack ~expand:true ~fill:true) () in
let button =
- GButton.button ~label:"Open" ~packing:hbox#pack () in
+ GButton.button ~label:(s_ "Open") ~packing:hbox#pack () in
ignore (button#connect#clicked
~callback:(fun () ->
(* Just a cancel button in the action area. *)
let cancel_button =
- GButton.button ~label:"Cancel"
+ GButton.button ~label:(s_ "Cancel")
~packing:dlg#action_area#pack () in
ignore (cancel_button#connect#clicked
~callback:(fun () ->
*)
open Printf
+open Virt_ctrl_gettext.Gettext
module C = Libvirt.Connect
module D = Libvirt.Domain
view_col#set_sort_order sort_order;
view_col#set_sort_column_id sort_column_id
in
- append_visible_column "ID" col_name_id (Some (false, `ASCENDING, 0));
- append_visible_column "Name" col_domname (Some (true, `ASCENDING, 1));
- append_visible_column "Status" col_status None;
- append_visible_column "CPU" col_cpu None;
- append_visible_column "Memory" col_mem None;
+ append_visible_column (s_ "ID") col_name_id (Some (false, `ASCENDING, 0));
+ append_visible_column (s_ "Name") col_domname (Some (true, `ASCENDING, 1));
+ append_visible_column (s_ "Status") col_status None;
+ append_visible_column (s_ "CPU") col_cpu None;
+ append_visible_column (s_ "Memory") col_mem None;
let columns =
col_name_id, col_domname, col_status, col_cpu, col_mem, col_id in
*)
open Printf
+open Virt_ctrl_gettext.Gettext
open DBus
let debug = true
Hashtbl.replace services name uri
| _ ->
- prerr_endline "warning: unexpected message contents of Found signal"
+ prerr_endline (s_ "warning: unexpected message contents of Found signal")
(* Process an ItemRemove message, indicating that a service has
* gone away.
Hashtbl.remove services name
| _ ->
- prerr_endline "warning: unexpected message contents of ItemRemove signal"
+ prerr_endline
+ (s_ "warning: unexpected message contents of ItemRemove signal")
(* A service has appeared on the network. Resolve its IP address, etc. *)
let start_resolve_service bus err sb_path msg =
()
| _ ->
- prerr_endline "warning: unexpected message contents of ItemNew signal"
+ prerr_endline
+ (s_ "warning: unexpected message contents of ItemNew signal")
(* This is called when we get a message/signal. Could be from the
* (global) ServiceBrowser or any of the ServiceResolver objects.
remove_service bus err msg
| "org.freedesktop.DBus", _ -> ()
| interface, member ->
- eprintf "warning: ignored unknown message %s from %s\n%!"
- member interface
+ let () =
+ eprintf (f_ "warning: ignored unknown message %s from %s\n%!")
+ member interface in
+ ()
);
true
| None ->
let err = Error.init () in
let bus = Bus.get Bus.System err in
- if Error.is_set err then failwith "error set after getting System bus";
+ if Error.is_set err then
+ failwith (s_ "error set after getting System bus");
(* Create a new ServiceBrowser object which emits a signal whenever
* a new network service of the type specified is found on the network.
*)
open Printf
+open Virt_ctrl_gettext.Gettext
module C = Libvirt.Connect
module D = Libvirt.Domain
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*)
+open Virt_ctrl_gettext.Gettext
+
module C = Libvirt.Connect
module D = Libvirt.Domain
module N = Libvirt.Network
d (List.sort compare xs, List.sort compare ys)
let string_of_domain_state = function
- | D.InfoNoState -> "unknown"
- | D.InfoRunning -> "running"
- | D.InfoBlocked -> "blocked"
- | D.InfoPaused -> "paused"
- | D.InfoShutdown -> "shutdown"
- | D.InfoShutoff -> "shutoff"
- | D.InfoCrashed -> "crashed"
+ | D.InfoNoState -> s_ "unknown"
+ | D.InfoRunning -> s_ "running"
+ | D.InfoBlocked -> s_ "blocked"
+ | D.InfoPaused -> s_ "paused"
+ | D.InfoShutdown -> s_ "shutdown"
+ | D.InfoShutoff -> s_ "shutoff"
+ | D.InfoCrashed -> s_ "crashed"
(* Filter top level rows (only) in a tree_store. If function f returns
* true then the row remains, but if it returns false then the row is
*)
open Printf
+open Virt_ctrl_gettext.Gettext
-let title = "Virtual Control"
+let title = s_ "Virtual Control"
let utf8_copyright = "\194\169"
GToolbox.message_box
~title
~icon
- ("Virtualization control tool (virt-ctrl) by\n" ^
- "Richard W.M. Jones (rjones@redhat.com).\n\n" ^
- "Copyright " ^ utf8_copyright ^ " 2007-2008 Red Hat Inc.\n\n" ^
- "Libvirt version: " ^ virt_version ^ "\n" ^
- "Gtk toolkit version: " ^ gtk_version)
+ (sprintf (f_ "Virtualization control tool (virt-ctrl) by
+Richard W.M. Jones (rjones@redhat.com).
+
+Copyright %s 2007-2008 Red Hat Inc.
+
+Libvirt version: %s
+
+Gtk toolkit version: %s") utf8_copyright virt_version gtk_version)
(* Catch any exception and throw up a dialog. *)
let () =
(* A nicer exception printing function. *)
let string_of_exn = function
| Libvirt.Virterror err ->
- "Virtualisation error: " ^ (Libvirt.Virterror.to_string err)
+ s_ "Virtualisation error" ^ ": " ^ (Libvirt.Virterror.to_string err)
| Failure msg -> msg
| exn -> Printexc.to_string exn
in
fun exn ->
let label = string_of_exn exn in
prerr_endline label;
- let title = "Error" in
+ let title = s_ "Error" in
let icon = GMisc.image () in
icon#set_stock `DIALOG_ERROR;
icon#set_icon_size `DIALOG;
let menubar = GMenu.menu_bar ~packing:vbox#pack () in
let factory = new GMenu.factory menubar in
let accel_group = factory#accel_group in
- let file_menu = factory#add_submenu "File" in
- let help_menu = factory#add_submenu "Help" in
+ let file_menu = factory#add_submenu (s_ "File") in
+ let help_menu = factory#add_submenu (s_ "Help") in
window#add_accel_group accel_group;
(* File menu. *)
let factory = new GMenu.factory file_menu ~accel_group in
- let open_item = factory#add_item "Open connection ..."
+ let open_item = factory#add_item (s_ "Open connection ...")
~key:GdkKeysyms._O in
ignore (factory#add_separator ());
- let quit_item = factory#add_item "Quit" ~key:GdkKeysyms._Q in
+ let quit_item = factory#add_item (s_ "Quit") ~key:GdkKeysyms._Q in
ignore (open_item#connect#activate
~callback:(Vc_connection_dlg.open_connection window));
(* Help menu. *)
let factory = new GMenu.factory help_menu ~accel_group in
- let help_item = factory#add_item "Help" in
- let help_about_item = factory#add_item "About ..." in
+ let help_item = factory#add_item (s_ "Help") in
+ let help_about_item = factory#add_item (s_ "About ...") in
ignore (help_about_item#connect#activate ~callback:help_about);
let connect_button_menu = GMenu.menu () in
let connect_button =
GButton.menu_tool_button
- ~label:"Connect ..." ~stock:`CONNECT
+ ~label:(s_ "Connect ...") ~stock:`CONNECT
~menu:connect_button_menu
~packing:toolbar#insert () in
ignore (GButton.separator_tool_item ~packing:toolbar#insert ());
let open_button =
- GButton.tool_button ~label:"Details" ~stock:`OPEN
+ GButton.tool_button ~label:(s_ "Details") ~stock:`OPEN
~packing:toolbar#insert () in
ignore (GButton.separator_tool_item ~packing:toolbar#insert ());
let start_button =
- GButton.tool_button ~label:"Start" ~stock:`ADD
+ GButton.tool_button ~label:(s_ "Start") ~stock:`ADD
~packing:toolbar#insert () in
let pause_button =
- GButton.tool_button ~label:"Pause" ~stock:`MEDIA_PAUSE
+ GButton.tool_button ~label:(s_ "Pause") ~stock:`MEDIA_PAUSE
~packing:toolbar#insert () in
let resume_button =
- GButton.tool_button ~label:"Resume" ~stock:`MEDIA_PLAY
+ GButton.tool_button ~label:(s_ "Resume") ~stock:`MEDIA_PLAY
~packing:toolbar#insert () in
ignore (GButton.separator_tool_item ~packing:toolbar#insert ());
let shutdown_button =
- GButton.tool_button ~label:"Shutdown" ~stock:`STOP
+ GButton.tool_button ~label:(s_ "Shutdown") ~stock:`STOP
~packing:toolbar#insert () in
(* Set callbacks for the toolbar buttons. *)
(* Set a menu on the connect menu-button. *)
let () =
let factory = new GMenu.factory connect_button_menu (*~accel_group*) in
- let local_xen = factory#add_item "Local Xen" in
- let local_qemu = factory#add_item "Local QEMU/KVM" in
+ let local_xen = factory#add_item (s_ "Local Xen") in
+ let local_qemu = factory#add_item (s_ "Local QEMU/KVM") in
ignore (factory#add_separator ());
- let open_dialog = factory#add_item "Connect to ..." in
+ let open_dialog = factory#add_item (s_ "Connect to ...") in
ignore (local_xen#connect#activate
~callback:Vc_connection_dlg.open_local_xen);
ignore (local_qemu#connect#activate
*)
open Printf
+open Virt_ctrl_gettext.Gettext
let () =
(* Build the main window and wire up the buttons to the callback functions *)