Method: ActiveWindow::Application#setup
- Defined in:
- lib/active_window/application.rb
#setup ⇒ Object
creates the controllers, connects the signals calls ‘setup’ on each controller
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/active_window/application.rb', line 39 def setup @controller = {} Module.constants.grep(/.Controller$/).each do |klass| ctrl = Kernel.const_get(klass).instance ctrl.application = self ctrl.setup name = klass.to_s.sub('Controller','').underscore.to_sym # eg MyFirstController -> :my_first controller[name] = ctrl end glade.signal_autoconnect_full do |source, target, signal, handler, data| # for example: # source : instance of Gtk::ImageMenuItem # target : nil # signal : activate, clicked, pressed, etc. # handler : window.close, which would call WindowController.close() # data : nil #puts [source, target, signal, handler, data].inspect source.signal_connect(signal) { |,event| self.dispatch(handler, :source => source, :target => target, :signal => signal, :handler => handler, :data => data, :widget => , :event => event) } #source.signal_connect(signal) { self.(handler, data) } end end |