seed r637 - trunk/libseed



Author: racarr
Date: Sun Jan  4 07:07:08 2009
New Revision: 637
URL: http://svn.gnome.org/viewvc/seed?rev=637&view=rev

Log:
Named constructor rework:
Clutter.Texture.new_from_file --> new Clutter.Texture.from_file

Modified:
   trunk/libseed/seed-engine.c

Modified: trunk/libseed/seed-engine.c
==============================================================================
--- trunk/libseed/seed-engine.c	(original)
+++ trunk/libseed/seed-engine.c	Sun Jan  4 07:07:08 2009
@@ -282,7 +282,7 @@
 	// We just want to check if there IS an object, not actually throw an
 	// exception if we don't
 	// get it.
-	if (!
+	if (!this_object || !
 		((object = seed_value_to_object(ctx, this_object, 0)) ||
 		 (object = seed_pointer_get_pointer(ctx, this_object))))
 		instance_method = FALSE;
@@ -995,7 +995,24 @@
 				{
 					finfo = g_object_info_get_method((GIObjectInfo *) info, i);
 					flags = g_function_info_get_flags(finfo);
-					if (!(flags & GI_FUNCTION_IS_METHOD))
+					if (flags & GI_FUNCTION_IS_CONSTRUCTOR)
+					{
+						JSObjectRef constructor = 
+							JSObjectMake(ctx,
+										 gobject_named_constructor_class,
+										 finfo);
+						const gchar * fname =
+							g_base_info_get_name((GIBaseInfo *)
+												 finfo);
+						if (strstr(fname, "new_") == fname)
+							fname += 4;
+						
+						seed_object_set_property(ctx,
+												 constructor_ref,
+												 fname, 
+												 constructor);
+					}
+					else if (!(flags & GI_FUNCTION_IS_METHOD))
 					{
 						seed_gobject_define_property_from_function_info
 							(ctx, finfo, constructor_ref, FALSE);



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