<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -5,5 +5,5 @@ $:.push File.join(File.dirname(__FILE__), '..', 'lib')
 
 require 'redcar'
 Redcar.start
-Redcar.app.gui.run_features(ARGV)
+Redcar.gui.run_features(ARGV)
 Redcar.pump</diff>
      <filename>bin/cucumber</filename>
    </modified>
    <modified>
      <diff>@@ -4,13 +4,29 @@ require 'application/menu'
 require 'application/menu_item'
 
 module Redcar
-  def self.app
-    @app ||= Application.new
+  class &lt;&lt; self
+    attr_reader :gui, :app
+  end
+
+  def self.app=(app)
+    @app ||= app
+  end
+  
+  # Set the application GUI.
+  def self.gui=(gui)
+    raise &quot;can't set gui twice&quot; if @gui
+    @gui = gui
+    
+    bus[&quot;/system/ui/messagepump&quot;].set_proc do
+      @gui.controller_for(@app)
+      @gui.start
+    end
   end
   
   class Application
     NAME = &quot;Redcar&quot;
     
+    include Redcar::Model
     include FreeBASE::DataBusHelper
     
     def self.load
@@ -18,12 +34,16 @@ module Redcar
     end
     
     def self.start
+      Redcar.app = Application.new
       Redcar.app.new_window
     end
     
+    def initialize
+    end
+    
     # Immediately halts the gui event loop.
     def quit
-      @gui.stop
+      Redcar.gui.stop
     end
     
     # Return a list of all open windows
@@ -35,22 +55,17 @@ module Redcar
     def new_window
       new_window = Application::Window.new
       windows &lt;&lt; new_window
-      @gui.controller_for(new_window)
-      menu = Menu.new
-      menu &lt;&lt; Menu.new(&quot;File&quot;) 
-      menu &lt;&lt; Menu.new(&quot;Help&quot;)
+      Redcar.gui.controller_for(new_window)
+      # menu = Menu.new
+      # menu &lt;&lt; Menu.new(&quot;File&quot;) 
+      # menu &lt;&lt; Menu.new(&quot;Help&quot;)
+      new_window.show
     end
     
-    # Set the application GUI.
-    def gui=(gui)
-      raise &quot;can't set gui twice&quot; if @gui
-      @gui = gui
-      
-      bus[&quot;/system/ui/messagepump&quot;].set_proc do
-        @gui.start
-      end
+    # The main menu.
+    def menu=(menu)
+      @menu = menu
     end
     
-    attr_reader :gui
   end
 end
\ No newline at end of file</diff>
      <filename>plugins/application/lib/application.rb</filename>
    </modified>
    <modified>
      <diff>@@ -15,6 +15,10 @@ module Redcar
         Window.all &lt;&lt; self
       end
 
+      def show
+        controller.show
+      end
+
       def title
         &quot;Redcar&quot;
       end</diff>
      <filename>plugins/application/lib/application/window.rb</filename>
    </modified>
    <modified>
      <diff>@@ -5,7 +5,9 @@ require &quot;application_swt/window&quot;
 require &quot;application_swt/cucumber_runner&quot;
 
 module Redcar
-  module ApplicationSWT
+  class ApplicationSWT
+    include Redcar::Controller
+    
     def self.display
       @display ||= Swt::Widgets::Display.new
     end
@@ -13,10 +15,11 @@ module Redcar
     def self.load
       Swt::Widgets::Display.app_name = Redcar::Application::NAME
       gui = Redcar::Gui.new(&quot;swt&quot;)
+      gui.register_controller(Application =&gt; ApplicationSWT)
       gui.register_event_loop(EventLoop.new)
       gui.register_controller(Application::Window =&gt; Window)
       gui.register_features_runner(CucumberRunner.new)
-      Redcar.app.gui = gui
+      Redcar.gui = gui
     end
   end
 end</diff>
      <filename>plugins/application_swt/lib/application_swt.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,5 @@
 module Redcar
-  module ApplicationSWT
+  class ApplicationSWT
     class CucumberRunner
       START_DELAY = 1
     </diff>
      <filename>plugins/application_swt/lib/application_swt/cucumber_runner.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 
 module Redcar
-  module ApplicationSWT
+  class ApplicationSWT
     class EventLoop
       def initialize
         @running = false</diff>
      <filename>plugins/application_swt/lib/application_swt/event_loop.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,14 +1,16 @@
 
 module Redcar
-  module ApplicationSWT
+  class ApplicationSWT
     class Window
       include Redcar::Controller
       
-      def initialize(window)
-        @window = window
+      def initialize
         @shell = Swt::Widgets::Shell.new(ApplicationSWT.display)
+      end
+        
+      def show
         @shell.open
-        @shell.text = window.title
+        @shell.text = @model.title
       end
 
       def close</diff>
      <filename>plugins/application_swt/lib/application_swt/window.rb</filename>
    </modified>
    <modified>
      <diff>@@ -32,7 +32,7 @@ module Redcar
     #
     # @param [Object] an instance of a Redcar model
     def controller_for(model)
-      controller = @controllers[model.class].first.new(model)
+      controller = @controllers[model.class].first.new
       model.controller = controller
       controller.model = model
     end</diff>
      <filename>plugins/core/lib/core/gui.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>9f668ebe88b51073f4292f839eeed3c977764ebc</id>
    </parent>
  </parents>
  <author>
    <name>Daniel Lucraft</name>
    <email>dan@fluentradical.com</email>
  </author>
  <url>http://github.com/danlucraft/redcar/commit/a402cc376481c2743ec18b635144852133ca988e</url>
  <id>a402cc376481c2743ec18b635144852133ca988e</id>
  <committed-date>2009-09-27T03:02:14-07:00</committed-date>
  <authored-date>2009-09-27T03:02:14-07:00</authored-date>
  <message>Refactored ApplicationSWT to be a controller for Application. Moved gui up to be global</message>
  <tree>40af123122b07f2d363bdfc677f768fa0729e5d5</tree>
  <committer>
    <name>Daniel Lucraft</name>
    <email>dan@fluentradical.com</email>
  </committer>
</commit>
