Commit cff34af
Changed files (3)
lib
presentation
presenters
windows
lib/presentation/presenters/application_shell_presenter.rb
@@ -0,0 +1,16 @@
+class ApplicationShellPresenter
+ def initialize(view)
+ @view = view
+ end
+
+ def present
+ @view.set_title("Hello World")
+ @view.set_title("Hello World")
+ @view.signal_connect "destroy" do
+ Gtk.main_quit
+ end
+ @view.set_default_size 250, 200
+ @view.set_window_position Gtk::Window::POS_CENTER
+ @view.show_all
+ end
+end
lib/presentation/windows/application_shell.rb
@@ -1,12 +1,5 @@
class ApplicationShell < Gtk::Window
def initialize
super
- set_title("Hello World")
- signal_connect "destroy" do
- Gtk.main_quit
- end
- set_default_size 250, 200
- set_window_position Gtk::Window::POS_CENTER
- show
end
end
lib/application.rb
@@ -1,10 +1,12 @@
require 'gtk2'
require 'presentation/windows/application_shell'
+require 'presentation/presenters/application_shell_presenter'
class Application
def run(arguments)
Gtk.init
- ApplicationShell.new
+ presenter = ApplicationShellPresenter.new(ApplicationShell.new)
+ presenter.present
Gtk.main
end
end