main
1class ContainerConfiguration
2 extend Nasty::Command
3
4 def self.run(container)
5 builder = Gtk::Builder.new
6 file = File.join(File.dirname(__FILE__), '..', 'presentation', 'windows', "shell.xml")
7 builder.add_from_file(file)
8
9 container.register(:builder) { builder }.as_singleton
10 container.register(:window) { builder.get_object('window') }.as_singleton
11 container.register(:menubar) { builder.get_object('menubar') }.as_singleton
12 container.register(:symbol_textbox) { builder.get_object('symbol_textbox') }.as_singleton
13 container.register(:submit_button) { builder.get_object('submit_button') }.as_singleton
14 container.register(:output_view) { builder.get_object('output_textarea') }.as_singleton
15 container.register(:statusbar) { builder.get_object('statusbar') }.as_singleton
16
17 container.register(:event_aggregator) { EventAggregator.new }.as_singleton
18 container.register(:shell_view) { |x| x.build(ShellView) }.as_singleton
19 container.register(:shell_presenter) { |x| x.build(ShellPresenter) }.as_singleton
20 container.register(:application_controller) { |x| x.build(ApplicationController) }.as_singleton
21 container.register(:presenter_factory) { |x| x.build(PresenterFactory) }.as_singleton
22 container.register(:stock_service) { |x| StockService.new }.as_singleton
23 container.register(:stock_query) { |x| x.build(StockQuery) }
24 Spank::IOC.bind_to(container)
25 end
26end
27