Class: Grumblr::MessageDialog

Inherits:
Gtk::Dialog
  • Object
show all
Defined in:
lib/grumblr/ui.rb

Instance Method Summary collapse

Constructor Details

#initialize(text, stock = Gtk::Stock::DIALOG_ERROR) ⇒ MessageDialog

Returns a new instance of MessageDialog.



436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
# File 'lib/grumblr/ui.rb', line 436

def initialize(text, stock = Gtk::Stock::DIALOG_ERROR)
  super "Attention!", $gui, Gtk::Dialog::MODAL

  message = Gtk::Label.new(text)
  icon = Gtk::Image.new(stock, Gtk::IconSize::DIALOG)

  hbox = Gtk::HBox.new(false, 20)
  hbox.set_border_width 20
  hbox.pack_start icon, false
  hbox.pack_start message, true

  self.add_button(Gtk::Stock::OK, Gtk::Dialog::RESPONSE_NONE)
  self.signal_connect(:response) { self.destroy }
  self.vbox.add hbox
  self.show_all
  self.run
end