File: infobar.rb

package info (click to toggle)
ruby-gnome2 3.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 28,872 kB
  • sloc: ansic: 96,386; ruby: 70,722; xml: 350; sh: 105; cpp: 45; makefile: 34
file content (24 lines) | stat: -rwxr-xr-x 478 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