| Path: | bin/virt-p2v-launcher |
| Last Update: | Wed Oct 10 13:57:41 +0000 2012 |
Copyright (C) 2011 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.
| TRY_AGAIN | = | 0 |
| DEBUG | = | 1 |
| POWER_OFF | = | 2 |
| LOG | = | '/tmp/virt-p2v.log' |
# File bin/virt-p2v-launcher, line 31
31: def choose
32: option = nil
33:
34: window = Gtk::Window.new
35: window.window_position = Gtk::Window::POS_CENTER_ALWAYS
36: window.decorated = false
37: window.resizable = false
38: window.set_default_size(200, 200)
39:
40: vbox = Gtk::VBox.new(false, 10)
41: hbox = Gtk::HBox.new(true, 10)
42:
43: buttons = [
44: [ 'Try Again', TRY_AGAIN ],
45: [ 'Debug', DEBUG ],
46: [ 'Power off', POWER_OFF ]
47: ]
48:
49: buttons.each { |button|
50: label = button[0]
51: clicked = button[1]
52:
53: w = Gtk::Button.new(label)
54: w.signal_connect('clicked') {
55: option = clicked
56: window.destroy
57: Gtk.main_quit
58: }
59: hbox.pack_start(w)
60: }
61:
62: l = Gtk::Label.new("virt-p2v has shutdown unexpectedly. You may:\n\n* Try running it again\n* Debug virt-p2v\n* Power the machine off\n")
63:
64: vbox.border_width = 10
65: vbox.add(l)
66: vbox.add(hbox)
67: window.add(vbox)
68:
69: window.show_all
70: Gtk.main
71:
72: return option
73: end