Sha256: bff4cbc94ac30fb8e058ef6fac9d951ba574f4c3ce316a66221377c32ed85dee

Contents?: true

Size: 725 Bytes

Versions: 1

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

1 entries across 1 versions & 1 rubygems

Version Path
alexandria-book-collection-manager-0.7.3 lib/alexandria/ui/builder_base.rb