Method: TECSCDE.confirm?

Defined in:
lib/tecscde.rb

.confirm?(message, parent = nil) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/tecscde.rb', line 30

def self.confirm?(message, parent = nil)
  dialog = Gtk::Dialog.new(
    "Confirm",
    parent,
    Gtk::Dialog::Flags::MODAL | Gtk::Dialog::Flags::DESTROY_WITH_PARENT,
    [Gtk::Stock::OK, Gtk::ResponseType::OK],
    [Gtk::Stock::CANCEL, Gtk::ResponseType::CANCEL]
  )
  dialog.vbox.add(Gtk::Label.new(message))
  dialog.show_all
  response = dialog.run
  dialog.destroy
  response == Gtk::ResponseType::OK
end