Class: Gtk2AppLib::Dialogs::QuickMessage

Inherits:
Gtk::Dialog
  • Object
show all
Defined in:
lib/gtk2applib/dialogs/quick_message.rb

Overview

creates a quick message dialog

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ QuickMessage



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/gtk2applib/dialogs/quick_message.rb', line 10

def initialize(options)
  @options = options
  super(@options[:TITLE],
    @options[:WINDOW], @options[:FLAGS], *@options[:DIALOG_BUTTONS])
  # Add the message in a label, and
  # show everything we've added to the dialog.
  box = self.vbox
  if @options[:SCROLLED_WINDOW] then
    box = Widgets::ScrolledWindow.new(box, *@options[:ScrolledWindow])
  end
  @label = Widgets::Label.new('', box, *@options[:Label])
end

Instance Method Details

#run(message) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/gtk2applib/dialogs/quick_message.rb', line 23

def run(message)
  @label.text = message
  self.show_all
  # Ensure that the dialog box is destroyed when the user responds.
  self.signal_connect('response') { self.destroy }
  super()
end