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

Using glade interface file in ruby-gnome2. (See related posts)

   1  
   2  require 'gtk2'
   3  require 'libglade2'
   4  
   5  class SignalHandler
   6    def method_missing(method, *args)
   7      puts "#{method}: #{args}"
   8    end
   9  end
  10  sigmap = SignalHandler.new
  11  
  12  Gtk.init
  13  glade = GladeXML.new('hello.glade', nil, 'helloglade')
  14  window = glade['main_window']
  15  window.signal_connect("destroy") { Gtk.main_quit }
  16  glade.signal_autoconnect_full do |source, target, signal, handler, data|
  17    source.signal_connect(signal) { sigmap.send(handler, data) }
  18  end
  19  
  20  window.show
  21  Gtk.main


I did not know what file should I require. :(

You need to create an account or log in to post comments to this site.


Click here to browse all 5551 code snippets

Related Posts