seed r154 - in trunk: libseed tests



Author: racarr
Date: Fri Nov  7 06:04:35 2008
New Revision: 154
URL: http://svn.gnome.org/viewvc/seed?rev=154&view=rev

Log:
Pass instance as this to instance_init functions.


Modified:
   trunk/libseed/seed-gtype.c
   trunk/tests/gtype.js

Modified: trunk/libseed/seed-gtype.c
==============================================================================
--- trunk/libseed/seed-gtype.c	(original)
+++ trunk/libseed/seed-gtype.c	Fri Nov  7 06:04:35 2008
@@ -47,14 +47,16 @@
 											  void * userdata)
 {
 		JSObjectRef function = (JSObjectRef) userdata;
-		JSValueRef jsargs[2];
+		JSValueRef jsargs;
+		JSObjectRef this_object;
 		
-		jsargs[0] = seed_value_from_object(*(GObject**)args[0], 0);
-		jsargs[1] = seed_make_struct(*(gpointer*)args[1],0);
+		jsargs = seed_make_struct(*(gpointer*)args[1],0);
+		this_object = 
+			(JSObjectRef)seed_value_from_object(*(GObject**)args[0],0);
 		
 		JSObjectCallAsFunction(eng->context,
 							   function,
-							   0, 2, jsargs, 0);
+							   this_object, 1, &jsargs, 0);
 }
 
 static ffi_closure * seed_make_class_init_closure(JSObjectRef function)

Modified: trunk/tests/gtype.js
==============================================================================
--- trunk/tests/gtype.js	(original)
+++ trunk/tests/gtype.js	Fri Nov  7 06:04:35 2008
@@ -15,10 +15,10 @@
 	prototype.message = "Prototypes!";
 	Seed.print("In klass init");
     },
-    instance_init: function(widget, klass)
+    instance_init: function(klass)
     {
-	widget.title = "Hello!";
-	Seed.print("In constructor for " + widget);
+	this.title = "Hello!";
+	Seed.print("In constructor for " + this);
     }};
 
 HelloWindow = new GType(HelloWindowType);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]