Class: Alexandria::UI::BuilderBase

Inherits:
Object
  • Object
show all
Defined in:
lib/alexandria/ui/builder_base.rb

Instance Method Summary collapse

Constructor Details

#initialize(filename, widget_names) ⇒ BuilderBase

Returns a new instance of BuilderBase.



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/alexandria/ui/builder_base.rb', line 10

def initialize(filename, widget_names)
  file = File.join(Alexandria::Config::DATA_DIR, "glade", filename)
  builder = Gtk::Builder.new
  # TODO: This emits the warning 'GtkDialog mapped without a transient
  # parent. This is discouraged.'
  builder.add_from_file(file)
  builder.connect_signals do |handler|
    method(handler)
  end
  widget_names.each do |name|
    instance_variable_set("@#{name}".intern, builder[name.to_s])
  end
end