Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Gyoung-Yoon Noh

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Using glade interface file in ruby-gnome2.

require 'gtk2'
require 'libglade2'

class SignalHandler
  def method_missing(method, *args)
    puts "#{method}: #{args}"
  end
end
sigmap = SignalHandler.new

Gtk.init
glade = GladeXML.new('hello.glade', nil, 'helloglade')
window = glade['main_window']
window.signal_connect("destroy") { Gtk.main_quit }
glade.signal_autoconnect_full do |source, target, signal, handler, data|
  source.signal_connect(signal) { sigmap.send(handler, data) }
end

window.show
Gtk.main


I did not know what file should I require. :(
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS