def choose
option = nil
window = Gtk::Window.new
window.window_position = Gtk::Window::POS_CENTER_ALWAYS
window.decorated = false
window.resizable = false
window.set_default_size(200, 200)
vbox = Gtk::VBox.new(false, 10)
hbox = Gtk::HBox.new(true, 10)
buttons = [
[ 'Try Again', TRY_AGAIN ],
[ 'Debug', DEBUG ],
[ 'Power off', POWER_OFF ]
]
buttons.each { |button|
label = button[0]
clicked = button[1]
w = Gtk::Button.new(label)
w.signal_connect('clicked') {
option = clicked
window.destroy
Gtk.main_quit
}
hbox.pack_start(w)
}
l = Gtk::Label.new("virt-p2v has shutdown unexpectedly. You may:
* Try running it again
* Debug virt-p2v
* Power the machine off
")
vbox.border_width = 10
vbox.add(l)
vbox.add(hbox)
window.add(vbox)
window.show_all
Gtk.main
return option
end