Sha256: b09007bbdafde79350f34359c6d139bf89a806d09213809c4eb18c9459dc36d8

Contents?: true

Size: 706 Bytes

Versions: 4

Compression:

Stored size: 706 Bytes

Contents

class Gtk::Builder
	def initialize
		
	end
	
	def add_from_file(filename)
		cont = File.read(filename).gsub("<interface>", "<glade-interface>").gsub("</interface>", "</glade-interface>")
		cont = cont.gsub("<object", "<widget").gsub("</object>", "</widget>")
		cont = cont.gsub("<requires lib=\"gtk+\" version=\"2.16\"\/>", "")
		cont = cont.gsub("<requires lib=\"gtk+\" version=\"2.14\"\/>", "")
		cont = cont.gsub("<child type=\"label\">", "<child>")
		cont = cont.gsub("<child type=\"tab\">", "<child>")
		
		@glade = GladeXML.new(cont)
	end
	
	def connect_signals(&block)
		@glade.block = block
		@glade.auto_connect(@glade.data)
	end
	
	def [](key)
		return @glade[key]
	end
	
	alias get_object []
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
knjrbfw-0.0.8 lib/knj/jruby-gtk2/builder.rb
knjrbfw-0.0.7 lib/knj/jruby-gtk2/builder.rb
knjrbfw-0.0.4 lib/knj/jruby-gtk2/builder.rb
knjrbfw-0.0.3 lib/knj/jruby-gtk2/builder.rb