[macruby-changes] [616] MacRuby/trunk/lib/hotcocoa/mappings/application.rb

source_changes at macosforge.org source_changes at macosforge.org
Tue Sep 23 16:38:01 PDT 2008


Revision: 616
          http://trac.macosforge.org/projects/ruby/changeset/616
Author:   rich at infoether.com
Date:     2008-09-23 16:38:00 -0700 (Tue, 23 Sep 2008)
Log Message:
-----------
refactor app for better reuse

Modified Paths:
--------------
    MacRuby/trunk/lib/hotcocoa/mappings/application.rb

Modified: MacRuby/trunk/lib/hotcocoa/mappings/application.rb
===================================================================
--- MacRuby/trunk/lib/hotcocoa/mappings/application.rb	2008-09-23 21:54:59 UTC (rev 615)
+++ MacRuby/trunk/lib/hotcocoa/mappings/application.rb	2008-09-23 23:38:00 UTC (rev 616)
@@ -5,19 +5,23 @@
   end
   
   def handle_block(application, &block)
-    begin
-      require 'lib/menu'
-      o = Object.new
-      o.extend HotCocoa
-      application.menu = o.application_menu
-    rescue LoadError => e
-    end
+    application.load_application_menu
     block.call(application)
     application.run
   end
   
   custom_methods do
     
+    def load_application_menu
+      begin
+        require 'lib/menu'
+        o = Object.new
+        o.extend HotCocoa
+        setMainMenu(o.application_menu)
+      rescue LoadError => e
+      end
+    end
+    
     def name=(name)
       @name = name
     end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080923/fa9b2baa/attachment.html 


More information about the macruby-changes mailing list