Sha256: a15afd1da6d8529dc306a3438325cdf5974e4459658f710d80f2621fbf350c16

Contents?: true

Size: 725 Bytes

Versions: 7

Compression:

Stored size: 725 Bytes

Contents

# frozen_string_literal: true

# This file is part of Alexandria.
#
# See the file README.md for authorship and licensing information.

module Alexandria
  module UI
    class BuilderBase
      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
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
alexandria-book-collection-manager-0.7.10 lib/alexandria/ui/builder_base.rb
alexandria-book-collection-manager-0.7.9 lib/alexandria/ui/builder_base.rb
alexandria-book-collection-manager-0.7.8 lib/alexandria/ui/builder_base.rb
alexandria-book-collection-manager-0.7.7 lib/alexandria/ui/builder_base.rb
alexandria-book-collection-manager-0.7.6 lib/alexandria/ui/builder_base.rb
alexandria-book-collection-manager-0.7.5 lib/alexandria/ui/builder_base.rb
alexandria-book-collection-manager-0.7.4 lib/alexandria/ui/builder_base.rb