Enlightenment CVS committal

Author  : nerochiaro
Project : e17
Module  : proto

Dir     : e17/proto/ruby-efl/src/enhance


Modified Files:
        config.rb handmade.rb 


Log Message:
ruby-enhance: removed functions to set data ptr for callback handlers. The 
example now shows the proper ruby way to obtain the same effect. 
Also added automatic wrapping of var_get return value

===================================================================
RCS file: /cvs/e/e17/proto/ruby-efl/src/enhance/config.rb,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- config.rb   11 Aug 2006 11:47:06 -0000      1.1
+++ config.rb   14 Aug 2006 20:33:03 -0000      1.2
@@ -30,5 +30,6 @@
         ] ,
        
        :ignore => [
+        'enhance_callback_data_set', 'enhance_callback_data_get'
        ]
 }
===================================================================
RCS file: /cvs/e/e17/proto/ruby-efl/src/enhance/handmade.rb,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- handmade.rb 11 Aug 2006 11:47:06 -0000      1.1
+++ handmade.rb 14 Aug 2006 20:33:03 -0000      1.2
@@ -17,14 +17,13 @@
         end
     end
 
-    def each_widget(&block)
+   def each_widget(&block)
         e = self.widgets_start
         e = e.ref
         while true
             name = self.widgets_next(e) 
 
-            return self.widgets_end(e) if name.nil? 
-            
+            return nil if name.nil?
             yield name
         end
     end
@@ -39,7 +38,7 @@
                 # First let's check that there's actually a method that we can 
use as handler.
                 begin hand_proc = handlers_holder.method(handler_name)
                 rescue NameError
-                    dWL("No handler defined for #{signal_name} => 
#{handler_name} on widget #{widget_name}", :misc)
+                    CClass.dWL("No handler defined for #{signal_name} => 
#{handler_name} on widget #{widget_name}", :misc)
                     next
                 end
 
@@ -58,4 +57,32 @@
             }
         }
     end
+    
+    # This overrides the original var_get and automatically wraps the returned 
pointer to the right
+    # Etk widget type (by querying it from the Etk runtime)
+    # todo: this will be reworked when the autowrap feature is implemented 
globally in dl_auto itself
+    #
+    def var_get(name)
+        w = self.class.var_get(self.this, name)
+        return nil if w.nil?
+        type = Etk::Type.wrap(Etk::EObject.object_type(w))
+        type = type.name.gsub(/^Etk_/,'')
+        
+        begin kl = Etk::const_get(type)
+        rescue NameError
+            type.downcase!
+            Etk::constants.each { |con|
+                con = Etk::const_get(con)
+                next if !con.ancestors.include?(CClass)
+                next if type != con.wrapped_class
+                kl = con
+                break
+            }
+        end
+        
+        return w if kl.nil? 
+        return kl.wrap(w)
+    end
+end
+    
 end



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to