Class: Iconify::TerminalWindow
- Inherits:
-
Gtk::Window
- Object
- Gtk::Window
- Iconify::TerminalWindow
- Includes:
- Gtk
- Defined in:
- lib/iconify.rb
Instance Attribute Summary collapse
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Instance Method Summary collapse
- #exec ⇒ Object
-
#initialize(argv) ⇒ TerminalWindow
constructor
A new instance of TerminalWindow.
Constructor Details
#initialize(argv) ⇒ TerminalWindow
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/iconify.rb', line 17 def initialize(argv) super() @argv = argv @terminal = Vte::Terminal.new self.title = "iconify - #{argv[0]}" signal_connect('delete-event') do hide end @state = :stopped vbox = VBox.new hbox = HButtonBox.new = Button.new("Rerun") .signal_connect('clicked') do self.exec end signal_connect('changed') do .sensitive = (@state == :stopped) end = Button.new("Kill") .signal_connect('clicked') do Process.kill("KILL", @pid) if @pid end signal_connect('changed') do .sensitive = (@state == :running) end = Button.new("Quit") .signal_connect('clicked') do Gtk.main_quit end hbox.pack_start() hbox.pack_start() hbox.pack_start() vbox.pack_start(hbox, false) vbox.pack_start(@terminal) add vbox @terminal.signal_connect('child-exited') do @state = :stopped @pid = nil .sensitive = true signal_emit('changed') end end |
Instance Attribute Details
#state ⇒ Object (readonly)
Returns the value of attribute state.
15 16 17 |
# File 'lib/iconify.rb', line 15 def state @state end |
Instance Method Details
#exec ⇒ Object
70 71 72 73 74 |
# File 'lib/iconify.rb', line 70 def exec @pid = @terminal.fork_command(argv: @argv) @state = :running signal_emit('changed') end |