File: infobar.rb

package info (click to toggle)
ruby-gnome2 1.1.3-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 7,348 kB
  • sloc: ansic: 68,323; ruby: 21,381; sh: 76; xml: 35; makefile: 21
file content (24 lines) | stat: -rwxr-xr-x 469 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env ruby

require 'gtk2'

label=Gtk::Label.new.show

info=Gtk::InfoBar.new
info.no_show_all=true
info.content_area.add(label)
info.add_button(Gtk::Stock::OK, Gtk::ResponseType::OK)
info.signal_connect('response'){|info, response| info.hide}

w=Gtk::Window.new
w.add(info)
w.show_all
w.signal_connect("delete_event"){Gtk.main_quit}

GLib::Timeout.add_seconds(1){
  label.text='ERROR'
  info.message_type=Gtk::MessageType::ERROR
  info.show
  false
}
Gtk.main