seed r304 - trunk/libseed



Author: hortont
Date: Sat Nov 22 19:00:31 2008
New Revision: 304
URL: http://svn.gnome.org/viewvc/seed?rev=304&view=rev

Log:
Fix indentation.


Modified:
   trunk/libseed/seed-builtins.c
   trunk/libseed/seed-builtins.h
   trunk/libseed/seed-closure.c
   trunk/libseed/seed-closure.h
   trunk/libseed/seed-debug.h
   trunk/libseed/seed-engine.c
   trunk/libseed/seed-engine.h
   trunk/libseed/seed-exceptions.c
   trunk/libseed/seed-exceptions.h
   trunk/libseed/seed-gtype.c
   trunk/libseed/seed-private.h
   trunk/libseed/seed-signals.c
   trunk/libseed/seed-signals.h
   trunk/libseed/seed-structs.c
   trunk/libseed/seed-structs.h
   trunk/libseed/seed-types.c
   trunk/libseed/seed-types.h
   trunk/libseed/seed.h

Modified: trunk/libseed/seed-builtins.c
==============================================================================
--- trunk/libseed/seed-builtins.c	(original)
+++ trunk/libseed/seed-builtins.c	Sat Nov 22 19:00:31 2008
@@ -29,80 +29,80 @@
 
 JSValueRef
 seed_include(JSContextRef ctx,
-	     JSObjectRef function,
-	     JSObjectRef this_object,
-	     size_t argumentCount,
-	     const JSValueRef arguments[], JSValueRef * exception)
-{
-    JSStringRef file_contents, file_name;
-    const gchar *import_file;
-    gchar *buffer, *walk;
-
-    if (argumentCount != 1)
-    {
-	gchar *mes =
-	    g_strdup_printf("Seed.include expected 1 argument, "
-			    "got %d", argumentCount);
-	seed_make_exception(exception, "ArgumentError", mes);
-	g_free(mes);
-	return JSValueMakeNull(ctx);
-    }
-    import_file = seed_value_to_string(arguments[0], exception);
-
-    g_file_get_contents(import_file, &buffer, 0, 0);
+			 JSObjectRef function,
+			 JSObjectRef this_object,
+			 size_t argumentCount,
+			 const JSValueRef arguments[], JSValueRef * exception)
+{
+	JSStringRef file_contents, file_name;
+	const gchar *import_file;
+	gchar *buffer, *walk;
 
-    if (!buffer)
-    {
-	gchar *mes = g_strdup_printf("File not found: %s.\n", import_file);
-	seed_make_exception(exception, "FileNotFound", mes);
-	g_free(mes);
-	return JSValueMakeNull(ctx);
-    }
+	if (argumentCount != 1)
+	{
+		gchar *mes =
+			g_strdup_printf("Seed.include expected 1 argument, "
+							"got %d", argumentCount);
+		seed_make_exception(exception, "ArgumentError", mes);
+		g_free(mes);
+		return JSValueMakeNull(ctx);
+	}
+	import_file = seed_value_to_string(arguments[0], exception);
 
-    walk = buffer;
+	g_file_get_contents(import_file, &buffer, 0, 0);
 
-    if (*walk == '#')
-    {
-	while (*walk != '\n')
-	    walk++;
-	walk++;
-    }
+	if (!buffer)
+	{
+		gchar *mes = g_strdup_printf("File not found: %s.\n", import_file);
+		seed_make_exception(exception, "FileNotFound", mes);
+		g_free(mes);
+		return JSValueMakeNull(ctx);
+	}
 
-    walk = strdup(walk);
-    g_free(buffer);
+	walk = buffer;
 
-    file_contents = JSStringCreateWithUTF8CString(walk);
-    file_name = JSStringCreateWithUTF8CString(import_file);
-    JSEvaluateScript(ctx, file_contents, NULL, file_name, 0, NULL);
+	if (*walk == '#')
+	{
+		while (*walk != '\n')
+			walk++;
+		walk++;
+	}
+
+	walk = strdup(walk);
+	g_free(buffer);
+
+	file_contents = JSStringCreateWithUTF8CString(walk);
+	file_name = JSStringCreateWithUTF8CString(import_file);
+	JSEvaluateScript(ctx, file_contents, NULL, file_name, 0, NULL);
 
-    JSStringRelease(file_contents);
-    JSStringRelease(file_name);
+	JSStringRelease(file_contents);
+	JSStringRelease(file_name);
 
-    return JSValueMakeNull(ctx);
+	return JSValueMakeNull(ctx);
 }
 
 JSValueRef
 seed_print(JSContextRef ctx,
-	   JSObjectRef function,
-	   JSObjectRef this_object,
-	   size_t argumentCount,
-	   const JSValueRef arguments[], JSValueRef * exception)
-{
-    if (argumentCount != 1)
-    {
-	gchar *mes =
-	    g_strdup_printf("Seed.print Expected 1 argument," " got %d",
-			    argumentCount);
-	seed_make_exception(exception, "ArgumentError", mes);
-	g_free(mes);
-	return JSValueMakeNull(ctx);
-    }
+		   JSObjectRef function,
+		   JSObjectRef this_object,
+		   size_t argumentCount,
+		   const JSValueRef arguments[], JSValueRef * exception)
+{
+	if (argumentCount != 1)
+	{
+		gchar *mes =
+			g_strdup_printf("Seed.print Expected 1 argument," " got %d",
+							argumentCount);
+		seed_make_exception(exception, "ArgumentError", mes);
+		g_free(mes);
+		return JSValueMakeNull(ctx);
+	}
 
-    gchar *buf = seed_value_to_string(arguments[0], exception);
-    printf("%s\n", buf);
-    g_free(buf);
+	gchar *buf = seed_value_to_string(arguments[0], exception);
+	printf("%s\n", buf);
+	g_free(buf);
 
-    return JSValueMakeNull(ctx);
+	return JSValueMakeNull(ctx);
 }
 
 JSValueRef
@@ -112,352 +112,352 @@
 			  size_t argumentCount,
 			  const JSValueRef arguments[], JSValueRef * exception)
 {
-    // TODO: Should add an interface to rl_bind_key
-    // Perhaps Seed.readline_bind('a', function)
-    // Then automagically do function stuff and make it happen!
-
-    JSValueRef valstr = 0;
-    gchar *str = 0;
-    gchar *buf;
+	// TODO: Should add an interface to rl_bind_key
+	// Perhaps Seed.readline_bind('a', function)
+	// Then automagically do function stuff and make it happen!
+
+	JSValueRef valstr = 0;
+	gchar *str = 0;
+	gchar *buf;
 
-    if (argumentCount != 1)
-    {
+	if (argumentCount != 1)
+	{
 		gchar *mes =
 			g_strdup_printf("Seed.readline Expected 1 argument, "
-					"got %d", argumentCount);
+							"got %d", argumentCount);
 		seed_make_exception(exception, "ArgumentError", mes);
 		g_free(mes);
 		return JSValueMakeNull(ctx);
-    }
+	}
 
-    buf = seed_value_to_string(arguments[0], exception);
+	buf = seed_value_to_string(arguments[0], exception);
 
-    str = readline(buf);
-    if (str && *str)
-    {
+	str = readline(buf);
+	if (str && *str)
+	{
 		add_history(str);
 		valstr = seed_value_from_string(str, exception);
 		g_free(str);
-    }
+	}
 
-    g_free(buf);
+	g_free(buf);
 
-    if (valstr == 0)
+	if (valstr == 0)
 		valstr = JSValueMakeNull(ctx);
 
-    return valstr;
+	return valstr;
 }
 
 JSValueRef
 seed_prototype(JSContextRef ctx,
-	       JSObjectRef function,
-	       JSObjectRef this_object,
-	       size_t argumentCount,
-	       const JSValueRef arguments[], JSValueRef * exception)
-{
-    GType type;
-
-    if (argumentCount != 1)
-    {
-	gchar *mes =
-	    g_strdup_printf("Seed.prototype Expected 1 argument, "
-			    "got %d", argumentCount);
-	seed_make_exception(exception, "ArgumentError", mes);
-	g_free(mes);
-	return JSValueMakeNull(eng->context);
-    }
-    if (!JSValueIsObject(eng->context, arguments[0]))
-	return JSValueMakeNull(eng->context);
+			   JSObjectRef function,
+			   JSObjectRef this_object,
+			   size_t argumentCount,
+			   const JSValueRef arguments[], JSValueRef * exception)
+{
+	GType type;
 
-    type = (GType) JSObjectGetPrivate((JSObjectRef) arguments[0]);
+	if (argumentCount != 1)
+	{
+		gchar *mes =
+			g_strdup_printf("Seed.prototype Expected 1 argument, "
+							"got %d", argumentCount);
+		seed_make_exception(exception, "ArgumentError", mes);
+		g_free(mes);
+		return JSValueMakeNull(eng->context);
+	}
+	if (!JSValueIsObject(eng->context, arguments[0]))
+		return JSValueMakeNull(eng->context);
 
-    return seed_gobject_get_prototype_for_gtype(type);
+	type = (GType) JSObjectGetPrivate((JSObjectRef) arguments[0]);
+
+	return seed_gobject_get_prototype_for_gtype(type);
 }
 
 const gchar *seed_g_type_name_to_string(GITypeInfo * type)
 {
-    GITypeTag type_tag = g_type_info_get_tag(type);
+	GITypeTag type_tag = g_type_info_get_tag(type);
 
-    const gchar *type_name;
+	const gchar *type_name;
 
-    if (type_tag == GI_TYPE_TAG_INTERFACE)
-    {
-	GIBaseInfo *interface = g_type_info_get_interface(type);
-	type_name = g_base_info_get_name(interface);
-	g_base_info_unref(interface);
-    }
-    else
-    {
-	type_name = g_type_tag_to_string(type_tag);
-    }
+	if (type_tag == GI_TYPE_TAG_INTERFACE)
+	{
+		GIBaseInfo *interface = g_type_info_get_interface(type);
+		type_name = g_base_info_get_name(interface);
+		g_base_info_unref(interface);
+	}
+	else
+	{
+		type_name = g_type_tag_to_string(type_tag);
+	}
 
-    return type_name;
+	return type_name;
 }
 
 JSValueRef
 seed_introspect(JSContextRef ctx,
-		JSObjectRef function,
-		JSObjectRef this_object,
-		size_t argumentCount,
-		const JSValueRef arguments[], JSValueRef * exception)
-{
-    // TODO: LEAKY!
-
-    GICallableInfo *info;
-    JSObjectRef data_obj, args_obj;
-    gint i;
-
-    if (argumentCount != 1)
-    {
-	gchar *mes =
-	    g_strdup_printf("Seed.introspection Expected 1 argument, "
-			    "got %d", argumentCount);
-	seed_make_exception(exception, "ArgumentError", mes);
-	g_free(mes);
-	return JSValueMakeNull(ctx);
-    }
+				JSObjectRef function,
+				JSObjectRef this_object,
+				size_t argumentCount,
+				const JSValueRef arguments[], JSValueRef * exception)
+{
+	// TODO: LEAKY!
+
+	GICallableInfo *info;
+	JSObjectRef data_obj, args_obj;
+	gint i;
 
-    if (!JSValueIsObject(ctx, arguments[0]))
-	return JSValueMakeNull(ctx);
-    if (!JSValueIsObjectOfClass(ctx, arguments[0], gobject_method_class))
-	return JSValueMakeNull(ctx);
+	if (argumentCount != 1)
+	{
+		gchar *mes =
+			g_strdup_printf("Seed.introspection Expected 1 argument, "
+							"got %d", argumentCount);
+		seed_make_exception(exception, "ArgumentError", mes);
+		g_free(mes);
+		return JSValueMakeNull(ctx);
+	}
 
-    info = (GICallableInfo *) JSObjectGetPrivate((JSObjectRef) arguments[0]);
-    data_obj = JSObjectMake(ctx, NULL, NULL);
+	if (!JSValueIsObject(ctx, arguments[0]))
+		return JSValueMakeNull(ctx);
+	if (!JSValueIsObjectOfClass(ctx, arguments[0], gobject_method_class))
+		return JSValueMakeNull(ctx);
 
-    seed_object_set_property(data_obj, "name", (JSValueRef)
-			    seed_value_from_string(g_base_info_get_name
-						   ((GIBaseInfo *) info),
-						   exception));
+	info = (GICallableInfo *) JSObjectGetPrivate((JSObjectRef) arguments[0]);
+	data_obj = JSObjectMake(ctx, NULL, NULL);
 
-    seed_object_set_property(data_obj, "return_type",
-			    seed_value_from_string
-			    (seed_g_type_name_to_string
-			     (g_callable_info_get_return_type(info)),
-			     exception));
+	seed_object_set_property(data_obj, "name", (JSValueRef)
+							 seed_value_from_string(g_base_info_get_name
+													((GIBaseInfo *) info),
+													exception));
 
-    args_obj = JSObjectMake(eng->context, NULL, NULL);
+	seed_object_set_property(data_obj, "return_type",
+							 seed_value_from_string
+							 (seed_g_type_name_to_string
+							  (g_callable_info_get_return_type(info)),
+							  exception));
 
-    seed_object_set_property(data_obj, "args", args_obj);
+	args_obj = JSObjectMake(eng->context, NULL, NULL);
 
-    for (i = 0; i < g_callable_info_get_n_args(info); ++i)
-    {
-	JSObjectRef argument = JSObjectMake(ctx, NULL, NULL);
+	seed_object_set_property(data_obj, "args", args_obj);
 
-	const gchar *arg_name =
-	    seed_g_type_name_to_string(g_arg_info_get_type
-				       (g_callable_info_get_arg(info, i)));
+	for (i = 0; i < g_callable_info_get_n_args(info); ++i)
+	{
+		JSObjectRef argument = JSObjectMake(ctx, NULL, NULL);
 
-	seed_object_set_property(argument, "type",
-				seed_value_from_string(arg_name, exception));
+		const gchar *arg_name =
+			seed_g_type_name_to_string(g_arg_info_get_type
+									   (g_callable_info_get_arg(info, i)));
 
-	JSObjectSetPropertyAtIndex(ctx, args_obj, i, argument, NULL);
-    }
+		seed_object_set_property(argument, "type",
+								 seed_value_from_string(arg_name, exception));
 
-    return data_obj;
+		JSObjectSetPropertyAtIndex(ctx, args_obj, i, argument, NULL);
+	}
+
+	return data_obj;
 }
 
 JSValueRef
 seed_check_syntax(JSContextRef ctx,
-		  JSObjectRef function,
-		  JSObjectRef this_object,
-		  size_t argumentCount,
-		  const JSValueRef arguments[], JSValueRef * exception)
-{
-    if (argumentCount != 0)
-    {
-	JSStringRef jsstr = JSValueToStringCopy(ctx,
-						arguments[0],
-						exception);
-	JSCheckScriptSyntax(ctx, jsstr, 0, 0, exception);
-	if (jsstr)
-	    JSStringRelease(jsstr);
-    }
-    else
-    {
-	gchar *mes = g_strdup_printf("Seed.check_syntax expected"
-				     "0 argument, got %d",
-				     argumentCount);
-	seed_make_exception(exception, "ArgumentError", mes);
-	g_free(mes);
-    }
-    return JSValueMakeNull(ctx);
+				  JSObjectRef function,
+				  JSObjectRef this_object,
+				  size_t argumentCount,
+				  const JSValueRef arguments[], JSValueRef * exception)
+{
+	if (argumentCount != 0)
+	{
+		JSStringRef jsstr = JSValueToStringCopy(ctx,
+												arguments[0],
+												exception);
+		JSCheckScriptSyntax(ctx, jsstr, 0, 0, exception);
+		if (jsstr)
+			JSStringRelease(jsstr);
+	}
+	else
+	{
+		gchar *mes = g_strdup_printf("Seed.check_syntax expected"
+									 "0 argument, got %d",
+									 argumentCount);
+		seed_make_exception(exception, "ArgumentError", mes);
+		g_free(mes);
+	}
+	return JSValueMakeNull(ctx);
 }
 
 JSValueRef
 seed_fork(JSContextRef ctx,
-	  JSObjectRef function,
-	  JSObjectRef this_object,
-	  size_t argumentCount,
-	  const JSValueRef arguments[], JSValueRef * exception)
+		  JSObjectRef function,
+		  JSObjectRef this_object,
+		  size_t argumentCount,
+		  const JSValueRef arguments[], JSValueRef * exception)
 {
-    pid_t child;
+	pid_t child;
 
-    child = fork();
-    return seed_value_from_int(child, exception);
+	child = fork();
+	return seed_value_from_int(child, exception);
 }
 
 static gboolean seed_timeout_function(gpointer user_data)
 {
-    // Evaluate timeout script
+	// Evaluate timeout script
 
-    const JSStringRef script = (const JSStringRef)user_data;
-    JSEvaluateScript(eng->context, script, NULL, NULL, 0, NULL);
-    JSStringRelease(script);
+	const JSStringRef script = (const JSStringRef)user_data;
+	JSEvaluateScript(eng->context, script, NULL, NULL, 0, NULL);
+	JSStringRelease(script);
 
-    return FALSE;		// remove timeout from main loop
+	return FALSE;				// remove timeout from main loop
 }
 
 JSValueRef
 seed_set_timeout(JSContextRef ctx,
-		 JSObjectRef function,
-		 JSObjectRef this_object,
-		 size_t argumentCount,
-		 const JSValueRef arguments[], JSValueRef * exception)
-{
-    // TODO: check if a main loop is running. if not, return failure.
-
-    // GMainLoop* loop = g_main_loop_new(NULL,FALSE);
-    // if (!g_main_loop_is_running(loop))
-    // return JSValueMakeBoolean(ctx, 0);
-
-    if (argumentCount != 2)
-    {
-	gchar *mes =
-	    g_strdup_printf("Seed.set_timeout expected 2 arguments, "
-			    "got %d", argumentCount);
-	seed_make_exception(exception, "ArgumentError", mes);
-	g_free(mes);
-	return JSValueMakeBoolean(ctx, 0);
-    }
-
-    JSStringRef jsstr = JSValueToStringCopy(ctx,
-					    arguments[0],
-					    exception);
+				 JSObjectRef function,
+				 JSObjectRef this_object,
+				 size_t argumentCount,
+				 const JSValueRef arguments[], JSValueRef * exception)
+{
+	// TODO: check if a main loop is running. if not, return failure.
+
+	// GMainLoop* loop = g_main_loop_new(NULL,FALSE);
+	// if (!g_main_loop_is_running(loop))
+	// return JSValueMakeBoolean(ctx, 0);
 
-    guint interval = seed_value_to_uint(arguments[1], exception);
-    g_timeout_add(interval, &seed_timeout_function, jsstr);
+	if (argumentCount != 2)
+	{
+		gchar *mes =
+			g_strdup_printf("Seed.set_timeout expected 2 arguments, "
+							"got %d", argumentCount);
+		seed_make_exception(exception, "ArgumentError", mes);
+		g_free(mes);
+		return JSValueMakeBoolean(ctx, 0);
+	}
 
-    return JSValueMakeBoolean(ctx, 1);
+	JSStringRef jsstr = JSValueToStringCopy(ctx,
+											arguments[0],
+											exception);
+
+	guint interval = seed_value_to_uint(arguments[1], exception);
+	g_timeout_add(interval, &seed_timeout_function, jsstr);
+
+	return JSValueMakeBoolean(ctx, 1);
 }
 
 JSValueRef
 seed_closure(JSContextRef ctx,
-	     JSObjectRef function,
-	     JSObjectRef this_object,
-	     size_t argumentCount,
-	     const JSValueRef arguments[], JSValueRef * exception)
-{
-    SeedClosure *closure;
-
-    if (argumentCount < 1 || argumentCount > 2)
-    {
-	gchar *mes =
-	    g_strdup_printf("Seed.closure expected 1 or 2" "arguments, got %d",
-			    argumentCount);
-	seed_make_exception(exception, "ArgumentError", mes);
-	g_free(mes);
-	return JSValueMakeNull(ctx);
-    }
+			 JSObjectRef function,
+			 JSObjectRef this_object,
+			 size_t argumentCount,
+			 const JSValueRef arguments[], JSValueRef * exception)
+{
+	SeedClosure *closure;
 
-    if (argumentCount == 2)
-	closure =
-	    seed_make_gclosure((JSObjectRef) arguments[0],
-			       (JSObjectRef) arguments[1]);
-    else
-	closure = seed_make_gclosure((JSObjectRef) arguments[0], 0);
+	if (argumentCount < 1 || argumentCount > 2)
+	{
+		gchar *mes =
+			g_strdup_printf("Seed.closure expected 1 or 2" "arguments, got %d",
+							argumentCount);
+		seed_make_exception(exception, "ArgumentError", mes);
+		g_free(mes);
+		return JSValueMakeNull(ctx);
+	}
 
-    return (JSValueRef) seed_make_struct(closure, 0);
+	if (argumentCount == 2)
+		closure =
+			seed_make_gclosure((JSObjectRef) arguments[0],
+							   (JSObjectRef) arguments[1]);
+	else
+		closure = seed_make_gclosure((JSObjectRef) arguments[0], 0);
+
+	return (JSValueRef) seed_make_struct(closure, 0);
 }
 
 JSValueRef
 seed_closure_native(JSContextRef ctx,
-		    JSObjectRef function,
-		    JSObjectRef this_object,
-		    size_t argumentCount,
-		    const JSValueRef arguments[], JSValueRef * exception)
-{
-    ffi_cif *cif;
-    ffi_closure *closure;
-    ffi_type **arg_types;
-    ffi_arg result;
-    ffi_status status;
-    GICallableInfo *info;
-    GITypeInfo *return_type;
-    GIArgInfo *arg_info;
-    gint num_args, i;
-    SeedNativeClosure *privates;
-
-    if (argumentCount != 2)
-    {
-	gchar *mes =
-	    g_strdup_printf("Seed.closure_native expected"
-			    " 2 arguments, got %d",
-			    argumentCount);
-
-	seed_make_exception(exception, "ArgumentError", mes);
-	g_free(mes);
+					JSObjectRef function,
+					JSObjectRef this_object,
+					size_t argumentCount,
+					const JSValueRef arguments[], JSValueRef * exception)
+{
+	ffi_cif *cif;
+	ffi_closure *closure;
+	ffi_type **arg_types;
+	ffi_arg result;
+	ffi_status status;
+	GICallableInfo *info;
+	GITypeInfo *return_type;
+	GIArgInfo *arg_info;
+	gint num_args, i;
+	SeedNativeClosure *privates;
+
+	if (argumentCount != 2)
+	{
+		gchar *mes =
+			g_strdup_printf("Seed.closure_native expected"
+							" 2 arguments, got %d",
+							argumentCount);
 
-	return JSValueMakeNull(eng->context);
-    }
+		seed_make_exception(exception, "ArgumentError", mes);
+		g_free(mes);
+
+		return JSValueMakeNull(eng->context);
+	}
 
-    info = (GICallableInfo *) JSObjectGetPrivate((JSObjectRef) arguments[1]);
+	info = (GICallableInfo *) JSObjectGetPrivate((JSObjectRef) arguments[1]);
 
-    privates = seed_make_native_closure(info, arguments[0]);
+	privates = seed_make_native_closure(info, arguments[0]);
 
-    return JSObjectMake(eng->context, seed_native_callback_class, privates);
+	return JSObjectMake(eng->context, seed_native_callback_class, privates);
 }
 
 JSValueRef
 seed_quit(JSContextRef ctx,
-	  JSObjectRef function,
-	  JSObjectRef this_object,
-	  size_t argumentCount,
-	  const JSValueRef arguments[], JSValueRef * exception)
-{
-    if (argumentCount != 0)
-    {
-	if (!seed_value_to_int(arguments[0], NULL))
-	    exit(EXIT_SUCCESS);
-	else
-	    exit(EXIT_FAILURE);
-    }
+		  JSObjectRef function,
+		  JSObjectRef this_object,
+		  size_t argumentCount,
+		  const JSValueRef arguments[], JSValueRef * exception)
+{
+	if (argumentCount != 0)
+	{
+		if (!seed_value_to_int(arguments[0], NULL))
+			exit(EXIT_SUCCESS);
+		else
+			exit(EXIT_FAILURE);
+	}
 
-    exit(EXIT_SUCCESS);
+	exit(EXIT_SUCCESS);
 }
 
 void seed_init_builtins(gint * argc, gchar *** argv)
 {
-    guint i;
-    JSObjectRef arrayObj;
-    JSValueRef argcref;
-    JSObjectRef obj =
-	(JSObjectRef) seed_object_get_property(eng->global, "Seed");
-
-    seed_create_function("include", &seed_include, obj);
-    seed_create_function("print", &seed_print, obj);
-    seed_create_function("readline", &seed_readline, obj);
-    seed_create_function("prototype", &seed_prototype, obj);
-    seed_create_function("check_syntax", &seed_check_syntax, obj);
-    seed_create_function("introspect", &seed_introspect, obj);
-    seed_create_function("fork", &seed_fork, obj);
-    seed_create_function("closure", &seed_closure, obj);
-    seed_create_function("setTimeout", &seed_set_timeout, obj);
-    seed_create_function("closure_native", &seed_closure_native, obj);
-    seed_create_function("quit", &seed_quit, obj);
-
-    arrayObj = JSObjectMake(eng->context, NULL, NULL);
-
-    for (i = 0; i < *argc; ++i)
-    {
-	// TODO: exceptions!
-
-	JSObjectSetPropertyAtIndex(eng->context, arrayObj, i,
-				   seed_value_from_string((*argv)[i], 0), NULL);
-    }
+	guint i;
+	JSObjectRef arrayObj;
+	JSValueRef argcref;
+	JSObjectRef obj =
+		(JSObjectRef) seed_object_get_property(eng->global, "Seed");
+
+	seed_create_function("include", &seed_include, obj);
+	seed_create_function("print", &seed_print, obj);
+	seed_create_function("readline", &seed_readline, obj);
+	seed_create_function("prototype", &seed_prototype, obj);
+	seed_create_function("check_syntax", &seed_check_syntax, obj);
+	seed_create_function("introspect", &seed_introspect, obj);
+	seed_create_function("fork", &seed_fork, obj);
+	seed_create_function("closure", &seed_closure, obj);
+	seed_create_function("setTimeout", &seed_set_timeout, obj);
+	seed_create_function("closure_native", &seed_closure_native, obj);
+	seed_create_function("quit", &seed_quit, obj);
+
+	arrayObj = JSObjectMake(eng->context, NULL, NULL);
+
+	for (i = 0; i < *argc; ++i)
+	{
+		// TODO: exceptions!
+
+		JSObjectSetPropertyAtIndex(eng->context, arrayObj, i,
+								   seed_value_from_string((*argv)[i], 0), NULL);
+	}
 
-    argcref = seed_value_from_int(*argc, 0);
+	argcref = seed_value_from_int(*argc, 0);
 
-    seed_object_set_property(arrayObj, "length", argcref);
-    seed_object_set_property(obj, "argv", arrayObj);
+	seed_object_set_property(arrayObj, "length", argcref);
+	seed_object_set_property(obj, "argv", arrayObj);
 }

Modified: trunk/libseed/seed-builtins.h
==============================================================================
--- trunk/libseed/seed-builtins.h	(original)
+++ trunk/libseed/seed-builtins.h	Sat Nov 22 19:00:31 2008
@@ -28,31 +28,31 @@
 
 JSValueRef
 seed_include(JSContextRef ctx,
-	     JSObjectRef function,
-	     JSObjectRef this_object,
-	     size_t argumentCount,
-	     const JSValueRef arguments[], JSValueRef * exception);
+			 JSObjectRef function,
+			 JSObjectRef this_object,
+			 size_t argumentCount,
+			 const JSValueRef arguments[], JSValueRef * exception);
 
 JSValueRef
 seed_print(JSContextRef ctx,
-	   JSObjectRef function,
-	   JSObjectRef this_object,
-	   size_t argumentCount,
-	   const JSValueRef arguments[], JSValueRef * exception);
+		   JSObjectRef function,
+		   JSObjectRef this_object,
+		   size_t argumentCount,
+		   const JSValueRef arguments[], JSValueRef * exception);
 
 JSValueRef
 seed_readline(JSContextRef ctx,
-	      JSObjectRef function,
-	      JSObjectRef this_object,
-	      size_t argumentCount,
-	      const JSValueRef arguments[], JSValueRef * exception);
+			  JSObjectRef function,
+			  JSObjectRef this_object,
+			  size_t argumentCount,
+			  const JSValueRef arguments[], JSValueRef * exception);
 
 JSValueRef
 seed_introspect(JSContextRef ctx,
-		JSObjectRef function,
-		JSObjectRef this_object,
-		size_t argumentCount,
-		const JSValueRef arguments[], JSValueRef * exception);
+				JSObjectRef function,
+				JSObjectRef this_object,
+				size_t argumentCount,
+				const JSValueRef arguments[], JSValueRef * exception);
 
 void seed_init_builtins();
 

Modified: trunk/libseed/seed-closure.c
==============================================================================
--- trunk/libseed/seed-closure.c	(original)
+++ trunk/libseed/seed-closure.c	Sat Nov 22 19:00:31 2008
@@ -23,418 +23,413 @@
 
 static ffi_type *get_ffi_type(GITypeInfo * info)
 {
-    ffi_type *rettype;
+	ffi_type *rettype;
 
-    if (g_type_info_is_pointer(info))
-	rettype = &ffi_type_pointer;
-    else
-	switch (g_type_info_get_tag(info))
-	{
-	case GI_TYPE_TAG_VOID:
-	    rettype = &ffi_type_void;
-	    break;
-	case GI_TYPE_TAG_BOOLEAN:
-	    rettype = &ffi_type_uint;
-	    break;
-	case GI_TYPE_TAG_INT8:
-	    rettype = &ffi_type_sint8;
-	    break;
-	case GI_TYPE_TAG_UINT8:
-	    rettype = &ffi_type_uint8;
-	    break;
-	case GI_TYPE_TAG_INT16:
-	    rettype = &ffi_type_sint16;
-	    break;
-	case GI_TYPE_TAG_UINT16:
-	    rettype = &ffi_type_uint16;
-	    break;
-	case GI_TYPE_TAG_INT32:
-	    rettype = &ffi_type_sint32;
-	    break;
-	case GI_TYPE_TAG_UINT32:
-	    rettype = &ffi_type_uint32;
-	    break;
-	case GI_TYPE_TAG_INT64:
-	    rettype = &ffi_type_sint64;
-	    break;
-	case GI_TYPE_TAG_UINT64:
-	    rettype = &ffi_type_uint64;
-	    break;
-	case GI_TYPE_TAG_INT:
-	    rettype = &ffi_type_sint;
-	    break;
-	case GI_TYPE_TAG_UINT:
-	    rettype = &ffi_type_uint;
-	    break;
-	case GI_TYPE_TAG_SSIZE:	/* FIXME */
-	case GI_TYPE_TAG_LONG:
-	    rettype = &ffi_type_slong;
-	    break;
-	case GI_TYPE_TAG_SIZE:	/* FIXME */
-	case GI_TYPE_TAG_TIME_T:	/* May not be portable */
-	case GI_TYPE_TAG_ULONG:
-	    rettype = &ffi_type_ulong;
-	    break;
-	case GI_TYPE_TAG_FLOAT:
-	    rettype = &ffi_type_float;
-	    break;
-	case GI_TYPE_TAG_DOUBLE:
-	    rettype = &ffi_type_double;
-	    break;
-	case GI_TYPE_TAG_UTF8:
-	case GI_TYPE_TAG_FILENAME:
-	case GI_TYPE_TAG_ARRAY:
-	case GI_TYPE_TAG_INTERFACE:
-	case GI_TYPE_TAG_GLIST:
-	case GI_TYPE_TAG_GSLIST:
-	case GI_TYPE_TAG_GHASH:
-	case GI_TYPE_TAG_ERROR:
-	    rettype = &ffi_type_pointer;
-	    break;
-	default:
-	    g_assert_not_reached();
-	}
+	if (g_type_info_is_pointer(info))
+		rettype = &ffi_type_pointer;
+	else
+		switch (g_type_info_get_tag(info))
+		{
+		case GI_TYPE_TAG_VOID:
+			rettype = &ffi_type_void;
+			break;
+		case GI_TYPE_TAG_BOOLEAN:
+			rettype = &ffi_type_uint;
+			break;
+		case GI_TYPE_TAG_INT8:
+			rettype = &ffi_type_sint8;
+			break;
+		case GI_TYPE_TAG_UINT8:
+			rettype = &ffi_type_uint8;
+			break;
+		case GI_TYPE_TAG_INT16:
+			rettype = &ffi_type_sint16;
+			break;
+		case GI_TYPE_TAG_UINT16:
+			rettype = &ffi_type_uint16;
+			break;
+		case GI_TYPE_TAG_INT32:
+			rettype = &ffi_type_sint32;
+			break;
+		case GI_TYPE_TAG_UINT32:
+			rettype = &ffi_type_uint32;
+			break;
+		case GI_TYPE_TAG_INT64:
+			rettype = &ffi_type_sint64;
+			break;
+		case GI_TYPE_TAG_UINT64:
+			rettype = &ffi_type_uint64;
+			break;
+		case GI_TYPE_TAG_INT:
+			rettype = &ffi_type_sint;
+			break;
+		case GI_TYPE_TAG_UINT:
+			rettype = &ffi_type_uint;
+			break;
+		case GI_TYPE_TAG_SSIZE:	/* FIXME */
+		case GI_TYPE_TAG_LONG:
+			rettype = &ffi_type_slong;
+			break;
+		case GI_TYPE_TAG_SIZE:	/* FIXME */
+		case GI_TYPE_TAG_TIME_T:	/* May not be portable */
+		case GI_TYPE_TAG_ULONG:
+			rettype = &ffi_type_ulong;
+			break;
+		case GI_TYPE_TAG_FLOAT:
+			rettype = &ffi_type_float;
+			break;
+		case GI_TYPE_TAG_DOUBLE:
+			rettype = &ffi_type_double;
+			break;
+		case GI_TYPE_TAG_UTF8:
+		case GI_TYPE_TAG_FILENAME:
+		case GI_TYPE_TAG_ARRAY:
+		case GI_TYPE_TAG_INTERFACE:
+		case GI_TYPE_TAG_GLIST:
+		case GI_TYPE_TAG_GSLIST:
+		case GI_TYPE_TAG_GHASH:
+		case GI_TYPE_TAG_ERROR:
+			rettype = &ffi_type_pointer;
+			break;
+		default:
+			g_assert_not_reached();
+		}
 
-    return rettype;
+	return rettype;
 }
 
 static void seed_closure_finalize(JSObjectRef object)
 {
-    SeedNativeClosure *privates =
-	(SeedNativeClosure *) JSObjectGetPrivate(object);
+	SeedNativeClosure *privates =
+		(SeedNativeClosure *) JSObjectGetPrivate(object);
 
-    g_free(privates->cif->arg_types);
-    g_free(privates->cif);
-    JSValueUnprotect(eng->context, privates->function);
-    munmap(privates->closure, sizeof(ffi_closure));
+	g_free(privates->cif->arg_types);
+	g_free(privates->cif);
+	JSValueUnprotect(eng->context, privates->function);
+	munmap(privates->closure, sizeof(ffi_closure));
 }
 
 static void
 seed_handle_closure(ffi_cif * cif, void *result, void **args, void *userdata)
 {
-    SeedNativeClosure *privates = userdata;
-    gint num_args, i;
-    JSValueRef *jsargs;
-    JSValueRef return_value;
-    GITypeTag return_tag;
-    GIArgInfo *arg_info;
-    GITypeInfo *return_type;
-    GArgument rarg;
-    GArgument *return_arg = g_new0(GArgument, 1);
-    
-    
-    SEED_NOTE(INVOCATION, "Invoking closure of type: %s \n",
-	      g_base_info_get_name((GIBaseInfo *)privates->info));
-
-    num_args = g_callable_info_get_n_args(privates->info);
-    return_type = g_callable_info_get_return_type(privates->info);
-    return_tag = g_type_info_get_tag(return_type);
-    jsargs = (JSValueRef *) g_new0(JSValueRef, num_args);
-
-    for (i = 0; i < num_args; i++)
-    {
-	GITypeInfo *arg_type;
-	GITypeTag tag;
-	GType type;
-	GArgument *arg = &rarg;
-
-	arg_info = g_callable_info_get_arg(privates->info, i);
-	arg_type = g_arg_info_get_type(arg_info);
-	tag = g_type_info_get_tag(arg_type);
+	SeedNativeClosure *privates = userdata;
+	gint num_args, i;
+	JSValueRef *jsargs;
+	JSValueRef return_value;
+	GITypeTag return_tag;
+	GIArgInfo *arg_info;
+	GITypeInfo *return_type;
+	GArgument rarg;
+	GArgument *return_arg = g_new0(GArgument, 1);
+
+	SEED_NOTE(INVOCATION, "Invoking closure of type: %s \n",
+			  g_base_info_get_name((GIBaseInfo *) privates->info));
+
+	num_args = g_callable_info_get_n_args(privates->info);
+	return_type = g_callable_info_get_return_type(privates->info);
+	return_tag = g_type_info_get_tag(return_type);
+	jsargs = (JSValueRef *) g_new0(JSValueRef, num_args);
+
+	for (i = 0; i < num_args; i++)
+	{
+		GITypeInfo *arg_type;
+		GITypeTag tag;
+		GType type;
+		GArgument *arg = &rarg;
+
+		arg_info = g_callable_info_get_arg(privates->info, i);
+		arg_type = g_arg_info_get_type(arg_info);
+		tag = g_type_info_get_tag(arg_type);
+
+		switch (tag)
+		{
+		case GI_TYPE_TAG_BOOLEAN:
+			arg->v_boolean = *(gboolean *) args[i];
+			break;
+		case GI_TYPE_TAG_INT8:
+			arg->v_int8 = *(gint8 *) args[i];
+			break;
+		case GI_TYPE_TAG_UINT8:
+			arg->v_uint8 = *(guint8 *) args[i];
+			break;
+		case GI_TYPE_TAG_INT16:
+			arg->v_int16 = *(gint16 *) args[i];
+			break;
+		case GI_TYPE_TAG_UINT16:
+			arg->v_uint16 = *(guint16 *) args[i];
+			break;
+		case GI_TYPE_TAG_INT32:
+			arg->v_int32 = *(gint32 *) args[i];
+			break;
+		case GI_TYPE_TAG_UINT32:
+			arg->v_uint32 = *(guint32 *) args[i];
+			break;
+		case GI_TYPE_TAG_LONG:
+		case GI_TYPE_TAG_INT64:
+			arg->v_int64 = *(glong *) args[i];
+			break;
+		case GI_TYPE_TAG_ULONG:
+		case GI_TYPE_TAG_UINT64:
+			arg->v_uint64 = *(glong *) args[i];
+			break;
+		case GI_TYPE_TAG_INT:
+		case GI_TYPE_TAG_SSIZE:
+		case GI_TYPE_TAG_SIZE:
+			arg->v_int32 = *(gint *) args[i];
+			break;
+		case GI_TYPE_TAG_UINT:
+			arg->v_uint32 = *(guint *) args[i];
+			break;
+		case GI_TYPE_TAG_FLOAT:
+			arg->v_float = *(gfloat *) args[i];
+			break;
+		case GI_TYPE_TAG_DOUBLE:
+			arg->v_double = *(gdouble *) args[i];
+			break;
+		case GI_TYPE_TAG_UTF8:
+			arg->v_string = *(gchar **) args[i];
+			break;
+		case GI_TYPE_TAG_INTERFACE:
+			{
+				GIBaseInfo *interface;
+				GIInfoType interface_type;
+
+				interface = g_type_info_get_interface(arg_type);
+				interface_type = g_base_info_get_type(interface);
+
+				if (interface_type == GI_INFO_TYPE_OBJECT ||
+					interface_type == GI_INFO_TYPE_INTERFACE)
+				{
+					arg->v_pointer = *(gpointer *) args[i];
+					break;
+				}
+
+				else if (interface_type == GI_INFO_TYPE_ENUM ||
+						 interface_type == GI_INFO_TYPE_FLAGS)
+				{
+					arg->v_double = *(double *)args[i];
+					break;
+				}
+				else if (interface_type == GI_INFO_TYPE_STRUCT)
+				{
+					arg->v_pointer = *(gpointer *) args[i];
+					break;
+				}
+
+				g_base_info_unref(interface);
+			}
+		case GI_TYPE_TAG_GLIST:
+		case GI_TYPE_TAG_GSLIST:
+			arg->v_pointer = *(gpointer *) args[i];
+			break;
+		default:
+			arg->v_pointer = 0;
+		}
+		jsargs[i] = seed_gi_argument_make_js(arg, arg_type, 0);
+		seed_gi_release_in_arg(g_arg_info_get_ownership_transfer(arg_info),
+							   arg_type, arg);
+		g_base_info_unref((GIBaseInfo *) arg_info);
+	}
 
-	switch (tag)
+	return_value = (JSValueRef)
+		JSObjectCallAsFunction(eng->context,
+							   (JSObjectRef) privates->function, 0,
+							   num_args, jsargs, 0);
+
+	g_free(jsargs);
+
+	seed_gi_make_argument((JSValueRef) return_value, return_type,
+						  return_arg, 0);
+	switch (return_tag)
 	{
+
 	case GI_TYPE_TAG_BOOLEAN:
-	    arg->v_boolean = *(gboolean *) args[i];
-	    break;
+		*(gboolean *) result = return_arg->v_boolean;
+		break;
 	case GI_TYPE_TAG_INT8:
-	    arg->v_int8 = *(gint8 *) args[i];
-	    break;
+		*(gint8 *) result = return_arg->v_int8;
+		break;
 	case GI_TYPE_TAG_UINT8:
-	    arg->v_uint8 = *(guint8 *) args[i];
-	    break;
+		*(guint8 *) result = return_arg->v_uint8;
+		break;
 	case GI_TYPE_TAG_INT16:
-	    arg->v_int16 = *(gint16 *) args[i];
-	    break;
+		*(gint16 *) result = return_arg->v_int16;
+		break;
 	case GI_TYPE_TAG_UINT16:
-	    arg->v_uint16 = *(guint16 *) args[i];
-	    break;
+		return_arg->v_uint16 = *(guint16 *) args[i];
+		break;
 	case GI_TYPE_TAG_INT32:
-	    arg->v_int32 = *(gint32 *) args[i];
-	    break;
+		*(gint32 *) result = return_arg->v_int32;
+		break;
 	case GI_TYPE_TAG_UINT32:
-	    arg->v_uint32 = *(guint32 *) args[i];
-	    break;
+		*(guint32 *) result = return_arg->v_uint32;
+		break;
 	case GI_TYPE_TAG_LONG:
 	case GI_TYPE_TAG_INT64:
-	    arg->v_int64 = *(glong *) args[i];
-	    break;
+		*(glong *) result = return_arg->v_int64;
+		break;
 	case GI_TYPE_TAG_ULONG:
 	case GI_TYPE_TAG_UINT64:
-	    arg->v_uint64 = *(glong *) args[i];
-	    break;
+		*(glong *) result = return_arg->v_uint64;
+		break;
 	case GI_TYPE_TAG_INT:
 	case GI_TYPE_TAG_SSIZE:
 	case GI_TYPE_TAG_SIZE:
-	    arg->v_int32 = *(gint *) args[i];
-	    break;
+		*(gint *) result = return_arg->v_int32;
+		break;
 	case GI_TYPE_TAG_UINT:
-	    arg->v_uint32 = *(guint *) args[i];
-	    break;
+		*(guint *) result = return_arg->v_uint32;
+		break;
 	case GI_TYPE_TAG_FLOAT:
-	    arg->v_float = *(gfloat *) args[i];
-	    break;
+		*(gfloat *) result = return_arg->v_float;
+		break;
 	case GI_TYPE_TAG_DOUBLE:
-	    arg->v_double = *(gdouble *) args[i];
-	    break;
+		*(gdouble *) result = return_arg->v_double;
+		break;
 	case GI_TYPE_TAG_UTF8:
-	    arg->v_string = *(gchar **) args[i];
-	    break;
+		*(gchar **) result = return_arg->v_string;
+		break;
 	case GI_TYPE_TAG_INTERFACE:
-	    {
-		GIBaseInfo *interface;
-		GIInfoType interface_type;
-
-		interface = g_type_info_get_interface(arg_type);
-		interface_type = g_base_info_get_type(interface);
-
-		if (interface_type == GI_INFO_TYPE_OBJECT ||
-		    interface_type == GI_INFO_TYPE_INTERFACE)
 		{
-		    arg->v_pointer = *(gpointer *) args[i];
-		    break;
-		}
+			GIBaseInfo *interface;
+			GIInfoType interface_type;
 
-		else if (interface_type == GI_INFO_TYPE_ENUM ||
-			 interface_type == GI_INFO_TYPE_FLAGS)
-		{
-		    arg->v_double = *(double *)args[i];
-		    break;
-		}
-		else if (interface_type == GI_INFO_TYPE_STRUCT)
-		{
-		    arg->v_pointer = *(gpointer *) args[i];
-		    break;
+			interface = g_type_info_get_interface(return_type);
+			interface_type = g_base_info_get_type(interface);
+
+			if (interface_type == GI_INFO_TYPE_OBJECT ||
+				interface_type == GI_INFO_TYPE_INTERFACE)
+			{
+				*(gpointer *) result = return_arg->v_pointer;
+				break;
+			}
+
+			else if (interface_type == GI_INFO_TYPE_ENUM ||
+					 interface_type == GI_INFO_TYPE_FLAGS)
+			{
+				*(double *)result = return_arg->v_double;
+				break;
+			}
+			else if (interface_type == GI_INFO_TYPE_STRUCT)
+			{
+				*(gpointer *) result = return_arg->v_pointer;
+				break;
+			}
 		}
-		
-		g_base_info_unref(interface);
-	    }
 	case GI_TYPE_TAG_GLIST:
 	case GI_TYPE_TAG_GSLIST:
-	    arg->v_pointer = *(gpointer *) args[i];
-	    break;
-	default:
-	    arg->v_pointer = 0;
-	}
-	jsargs[i] = seed_gi_argument_make_js(arg, arg_type, 0);
-	seed_gi_release_in_arg(
-	    g_arg_info_get_ownership_transfer(arg_info),
-	    arg_type,
-	    arg);
-	g_base_info_unref((GIBaseInfo *)arg_info);
-    }
-
-
-
-    return_value = (JSValueRef)
-	JSObjectCallAsFunction(eng->context,
-			       (JSObjectRef) privates->function, 0,
-			       num_args, jsargs, 0);
-    
-    g_free(jsargs);
-
-    seed_gi_make_argument((JSValueRef) return_value, return_type,
-			  return_arg, 0);
-    switch (return_tag)
-    {
-
-    case GI_TYPE_TAG_BOOLEAN:
-	*(gboolean *) result = return_arg->v_boolean;
-	break;
-    case GI_TYPE_TAG_INT8:
-	*(gint8 *) result = return_arg->v_int8;
-	break;
-    case GI_TYPE_TAG_UINT8:
-	*(guint8 *) result = return_arg->v_uint8;
-	break;
-    case GI_TYPE_TAG_INT16:
-	*(gint16 *) result = return_arg->v_int16;
-	break;
-    case GI_TYPE_TAG_UINT16:
-	return_arg->v_uint16 = *(guint16 *) args[i];
-	break;
-    case GI_TYPE_TAG_INT32:
-	*(gint32 *) result = return_arg->v_int32;
-	break;
-    case GI_TYPE_TAG_UINT32:
-	*(guint32 *) result = return_arg->v_uint32;
-	break;
-    case GI_TYPE_TAG_LONG:
-    case GI_TYPE_TAG_INT64:
-	*(glong *) result = return_arg->v_int64;
-	break;
-    case GI_TYPE_TAG_ULONG:
-    case GI_TYPE_TAG_UINT64:
-	*(glong *) result = return_arg->v_uint64;
-	break;
-    case GI_TYPE_TAG_INT:
-    case GI_TYPE_TAG_SSIZE:
-    case GI_TYPE_TAG_SIZE:
-	*(gint *) result = return_arg->v_int32;
-	break;
-    case GI_TYPE_TAG_UINT:
-	*(guint *) result = return_arg->v_uint32;
-	break;
-    case GI_TYPE_TAG_FLOAT:
-	*(gfloat *) result = return_arg->v_float;
-	break;
-    case GI_TYPE_TAG_DOUBLE:
-	*(gdouble *) result = return_arg->v_double;
-	break;
-    case GI_TYPE_TAG_UTF8:
-	*(gchar **) result = return_arg->v_string;
-	break;
-    case GI_TYPE_TAG_INTERFACE:
-	{
-	    GIBaseInfo *interface;
-	    GIInfoType interface_type;
-
-	    interface = g_type_info_get_interface(return_type);
-	    interface_type = g_base_info_get_type(interface);
-
-	    if (interface_type == GI_INFO_TYPE_OBJECT ||
-		interface_type == GI_INFO_TYPE_INTERFACE)
-	    {
 		*(gpointer *) result = return_arg->v_pointer;
 		break;
-	    }
-
-	    else if (interface_type == GI_INFO_TYPE_ENUM ||
-		     interface_type == GI_INFO_TYPE_FLAGS)
-	    {
-		*(double *)result = return_arg->v_double;
-		break;
-	    }
-	    else if (interface_type == GI_INFO_TYPE_STRUCT)
-	    {
-		*(gpointer *) result = return_arg->v_pointer;
-		break;
-	    }
+	default:
+		*(gpointer *) result = 0;
 	}
-    case GI_TYPE_TAG_GLIST:
-    case GI_TYPE_TAG_GSLIST:
-	*(gpointer *) result = return_arg->v_pointer;
-	break;
-    default:
-	*(gpointer *) result = 0;
-    }
-    
-    g_free(return_arg);
+
+	g_free(return_arg);
 }
 
 SeedNativeClosure *seed_make_native_closure(GICallableInfo * info,
-					    JSValueRef function)
+											JSValueRef function)
 {
-    ffi_cif *cif;
-    ffi_closure *closure;
-    ffi_type **arg_types;
-    ffi_arg result;
-    ffi_status status;
-    GITypeInfo *return_type;
-    GIArgInfo *arg_info;
-    gint num_args, i;
-    SeedNativeClosure *privates;
-    JSObjectRef cached;
-
-    cached =
-	(JSObjectRef) seed_object_get_property((JSObjectRef)function,
-					      "__seed_native_closure");
-    if (cached
-	&& JSValueIsObjectOfClass(eng->context, cached,
-				  seed_native_callback_class))
-    {
-	return (SeedNativeClosure *) JSObjectGetPrivate(cached);
-    }
-
-    num_args = g_callable_info_get_n_args(info);
-    return_type = g_callable_info_get_return_type(info);
-    arg_types = (ffi_type **) g_new0(ffi_type *, num_args + 1);
-    cif = g_new0(ffi_cif, 1);
-
-    privates = g_new0(SeedNativeClosure, 1);
-    privates->info = info;
-    privates->function = function;
-    privates->cif = cif;
-    JSValueProtect(eng->context, privates->function);
-
-    for (i = 0; i < num_args; i++)
-    {
-	arg_info = g_callable_info_get_arg(info, i);
-	arg_types[i] = get_ffi_type(g_arg_info_get_type(arg_info));
-    }
-    arg_types[num_args] = 0;
-
-    closure = mmap(0, sizeof(ffi_closure), PROT_READ | PROT_WRITE |
-		   PROT_EXEC, MAP_ANON | MAP_PRIVATE, -1, 0);
-    privates->closure = closure;
-
-    ffi_prep_cif(cif, FFI_DEFAULT_ABI, num_args,
-		 get_ffi_type(return_type), arg_types);
-    ffi_prep_closure(closure, cif, seed_handle_closure, privates);
-
-    seed_object_set_property((JSObjectRef) function,
-			    "__seed_native_closure",
-			    (JSValueRef) JSObjectMake(eng->context,
-						      seed_native_callback_class,
-						      privates));
+	ffi_cif *cif;
+	ffi_closure *closure;
+	ffi_type **arg_types;
+	ffi_arg result;
+	ffi_status status;
+	GITypeInfo *return_type;
+	GIArgInfo *arg_info;
+	gint num_args, i;
+	SeedNativeClosure *privates;
+	JSObjectRef cached;
+
+	cached =
+		(JSObjectRef) seed_object_get_property((JSObjectRef) function,
+											   "__seed_native_closure");
+	if (cached
+		&& JSValueIsObjectOfClass(eng->context, cached,
+								  seed_native_callback_class))
+	{
+		return (SeedNativeClosure *) JSObjectGetPrivate(cached);
+	}
+
+	num_args = g_callable_info_get_n_args(info);
+	return_type = g_callable_info_get_return_type(info);
+	arg_types = (ffi_type **) g_new0(ffi_type *, num_args + 1);
+	cif = g_new0(ffi_cif, 1);
+
+	privates = g_new0(SeedNativeClosure, 1);
+	privates->info = info;
+	privates->function = function;
+	privates->cif = cif;
+	JSValueProtect(eng->context, privates->function);
+
+	for (i = 0; i < num_args; i++)
+	{
+		arg_info = g_callable_info_get_arg(info, i);
+		arg_types[i] = get_ffi_type(g_arg_info_get_type(arg_info));
+	}
+	arg_types[num_args] = 0;
+
+	closure = mmap(0, sizeof(ffi_closure), PROT_READ | PROT_WRITE |
+				   PROT_EXEC, MAP_ANON | MAP_PRIVATE, -1, 0);
+	privates->closure = closure;
+
+	ffi_prep_cif(cif, FFI_DEFAULT_ABI, num_args,
+				 get_ffi_type(return_type), arg_types);
+	ffi_prep_closure(closure, cif, seed_handle_closure, privates);
+
+	seed_object_set_property((JSObjectRef) function,
+							 "__seed_native_closure",
+							 (JSValueRef) JSObjectMake(eng->context,
+													   seed_native_callback_class,
+													   privates));
 
-    return privates;
+	return privates;
 }
 
 SeedClosure *seed_make_gclosure(JSObjectRef function, JSObjectRef this)
 {
-    GClosure *closure;
+	GClosure *closure;
 
-    closure = g_closure_new_simple(sizeof(SeedClosure), 0);
-    g_closure_set_marshal(closure, seed_signal_marshal_func);
+	closure = g_closure_new_simple(sizeof(SeedClosure), 0);
+	g_closure_set_marshal(closure, seed_signal_marshal_func);
 
-    ((SeedClosure *) closure)->function = function;
-    ((SeedClosure *) closure)->object = 0;
-    if (this && !JSValueIsNull(eng->context, this))
-    {
-	JSValueProtect(eng->context, this);
-	((SeedClosure *) closure)->this = this;
-    }
-    else
-	((SeedClosure *) closure)->this = 0;
+	((SeedClosure *) closure)->function = function;
+	((SeedClosure *) closure)->object = 0;
+	if (this && !JSValueIsNull(eng->context, this))
+	{
+		JSValueProtect(eng->context, this);
+		((SeedClosure *) closure)->this = this;
+	}
+	else
+		((SeedClosure *) closure)->this = 0;
 
-    JSValueProtect(eng->context, function);
+	JSValueProtect(eng->context, function);
 
-    return (SeedClosure *) closure;
+	return (SeedClosure *) closure;
 }
 
 JSClassDefinition seed_native_callback_def = {
-    0,				/* Version, always 0 */
-    0,
-    "seed_native_callback",	/* Class Name */
-    0,				/* Parent Class */
-    NULL,			/* Static Values */
-    NULL,			/* Static Functions */
-    NULL,
-    seed_closure_finalize,	/* Finalize */
-    NULL,			/* Has Property */
-    NULL,			/* Get Property */
-    NULL,			/* Set Property */
-    NULL,			/* Delete Property */
-    NULL,			/* Get Property Names */
-    NULL,			/* Call As Function */
-    NULL,			/* Call As Constructor */
-    NULL,			/* Has Instance */
-    NULL			/* Convert To Type */
+	0,							/* Version, always 0 */
+	0,
+	"seed_native_callback",		/* Class Name */
+	0,							/* Parent Class */
+	NULL,						/* Static Values */
+	NULL,						/* Static Functions */
+	NULL,
+	seed_closure_finalize,		/* Finalize */
+	NULL,						/* Has Property */
+	NULL,						/* Get Property */
+	NULL,						/* Set Property */
+	NULL,						/* Delete Property */
+	NULL,						/* Get Property Names */
+	NULL,						/* Call As Function */
+	NULL,						/* Call As Constructor */
+	NULL,						/* Has Instance */
+	NULL						/* Convert To Type */
 };
 
 void seed_closures_init(void)
 {
-    seed_native_callback_class = JSClassCreate(&seed_native_callback_def);
-    JSClassRetain(seed_native_callback_class);
+	seed_native_callback_class = JSClassCreate(&seed_native_callback_def);
+	JSClassRetain(seed_native_callback_class);
 }

Modified: trunk/libseed/seed-closure.h
==============================================================================
--- trunk/libseed/seed-closure.h	(original)
+++ trunk/libseed/seed-closure.h	Sat Nov 22 19:00:31 2008
@@ -24,28 +24,28 @@
 #include "seed-private.h"
 
 typedef struct _SeedClosure {
-    GClosure closure;
-    JSObjectRef function;
-    JSObjectRef object;
-    JSObjectRef this;
-
-    JSValueRef user_data;
-    
-    GType return_type;
+	GClosure closure;
+	JSObjectRef function;
+	JSObjectRef object;
+	JSObjectRef this;
+
+	JSValueRef user_data;
+
+	GType return_type;
 } SeedClosure;
 
 typedef struct _SeedNativeClosure {
-    GICallableInfo *info;
-    JSValueRef function;
+	GICallableInfo *info;
+	JSValueRef function;
 
-    ffi_closure *closure;
-    ffi_cif *cif;
+	ffi_closure *closure;
+	ffi_cif *cif;
 } SeedNativeClosure;
 
 extern JSClassRef seed_native_callback_class;
 
 SeedNativeClosure *seed_make_native_closure(GICallableInfo * info,
-					    JSValueRef function);
+											JSValueRef function);
 SeedClosure *seed_make_gclosure(JSObjectRef function, JSObjectRef this);
 
 void seed_closures_init();

Modified: trunk/libseed/seed-debug.h
==============================================================================
--- trunk/libseed/seed-debug.h	(original)
+++ trunk/libseed/seed-debug.h	Sat Nov 22 19:00:31 2008
@@ -5,13 +5,12 @@
 
 #include <glib.h>
 
-typedef enum
-{
+typedef enum {
 	SEED_DEBUG_ALL = 1 << 0,
 	SEED_DEBUG_MISC = 1 << 1,
 	SEED_DEBUG_FINALIZATION = 1 << 2,
 	SEED_DEBUG_INITIALIZATION = 1 << 3,
-	SEED_DEBUG_INVOCATION = 1<< 4,
+	SEED_DEBUG_INVOCATION = 1 << 4,
 	SEED_DEBUG_SIGNAL = 1 << 5
 } SeedDebugFlag;
 
@@ -30,13 +29,13 @@
 #define SEED_MARK()      SEED_NOTE(MISC, "== mark ==")
 #define SEED_DBG(x) { a }
 
-#else /* !SEED_ENABLE_DEBUG */
+#else							/* !SEED_ENABLE_DEBUG */
 
 #define SEED_NOTE(type,...)
 #define SEED_MARK()
 #define SEED_DBG(x)
 
-#endif /* SEED_ENABLE_DEBUG */
+#endif							/* SEED_ENABLE_DEBUG */
 
 extern guint seed_debug_flags;
 

Modified: trunk/libseed/seed-engine.c
==============================================================================
--- trunk/libseed/seed-engine.c	(original)
+++ trunk/libseed/seed-engine.c	Sat Nov 22 19:00:31 2008
@@ -32,1232 +32,1215 @@
 
 gchar *glib_message = 0;
 
-guint seed_debug_flags = 0;  /* global seed debug flag */
+guint seed_debug_flags = 0;		/* global seed debug flag */
 
 #ifdef SEED_ENABLE_DEBUG
 static const GDebugKey seed_debug_keys[] = {
-  { "misc", SEED_DEBUG_MISC },
-  { "finalization", SEED_DEBUG_FINALIZATION },
-  { "initialization", SEED_DEBUG_INITIALIZATION },
-  { "signal", SEED_DEBUG_SIGNAL },
-  { "invocation", SEED_DEBUG_INVOCATION }
+	{"misc", SEED_DEBUG_MISC},
+	{"finalization", SEED_DEBUG_FINALIZATION},
+	{"initialization", SEED_DEBUG_INITIALIZATION},
+	{"signal", SEED_DEBUG_SIGNAL},
+	{"invocation", SEED_DEBUG_INVOCATION}
 };
-#endif /* SEED_ENABLE_DEBUG */
+#endif							/* SEED_ENABLE_DEBUG */
 
 static JSObjectRef
 seed_gobject_constructor_invoked(JSContextRef ctx,
-				 JSObjectRef constructor,
-				 size_t argumentCount,
-				 const JSValueRef arguments[],
-				 JSValueRef * exception)
-{
-    GType type;
-    GParameter *params;
-    GObjectClass *oclass;
-    GObject *gobject;
-    // Do we free GParamSpecs...? It's not clear.
-    GParamSpec *param_spec;
-    gchar *prop_name;
-    gint i, nparams = 0, length;
-    JSObjectRef ret;
-    JSPropertyNameArrayRef jsprops = 0;
-    JSStringRef jsprop_name;
-    JSValueRef jsprop_value;
-
-    type = (GType) JSObjectGetPrivate(constructor);
-    if (!type)
-	return 0;
-
-    oclass = g_type_class_ref(type);
-
-    if (argumentCount > 1)
-    {
-	gchar *mes = g_strdup_printf("Constructor expects"
-				     " 1 argument, got %d", argumentCount);
-	seed_make_exception(exception, "ArgumentError", mes);
-	g_free(mes);
-
-	return (JSObjectRef) JSValueMakeNull(eng->context);
-    }
-
-    if (argumentCount == 1)
-    {
-	if (!JSValueIsObject(eng->context, arguments[0]))
-	{
-	    seed_make_exception(exception, "ArgmuentError",
-				"Constructor expects object as argument");
-	    g_type_class_unref(oclass);
-	    return (JSObjectRef) JSValueMakeNull(eng->context);
-	}
-
-	jsprops = JSObjectCopyPropertyNames(eng->context,
-					    (JSObjectRef) arguments[0]);
-	nparams = JSPropertyNameArrayGetCount(jsprops);
-    }
-    i = 0;
-
-    params = g_new0(GParameter, nparams + 1);
-    SEED_NOTE(INITIALIZATION, "Constructing object of type %s",
-	      g_type_name(type));
-
-    while (i < nparams)
-    {
+								 JSObjectRef constructor,
+								 size_t argumentCount,
+								 const JSValueRef arguments[],
+								 JSValueRef * exception)
+{
 	GType type;
-	jsprop_name = JSPropertyNameArrayGetNameAtIndex(jsprops, i);
+	GParameter *params;
+	GObjectClass *oclass;
+	GObject *gobject;
+	// Do we free GParamSpecs...? It's not clear.
+	GParamSpec *param_spec;
+	gchar *prop_name;
+	gint i, nparams = 0, length;
+	JSObjectRef ret;
+	JSPropertyNameArrayRef jsprops = 0;
+	JSStringRef jsprop_name;
+	JSValueRef jsprop_value;
 
-	length = JSStringGetMaximumUTF8CStringSize(jsprop_name);
-	prop_name = g_malloc(length * sizeof(gchar));
-	JSStringGetUTF8CString(jsprop_name, prop_name, length);
+	type = (GType) JSObjectGetPrivate(constructor);
+	if (!type)
+		return 0;
 
-	param_spec = g_object_class_find_property(oclass, prop_name);
-	if (param_spec == NULL)
-	{
-	    gchar *mes =
-		g_strdup_printf("Invalid property for construction: %s",
-				prop_name);
-	    seed_make_exception(exception, "PropertyError", mes);
+	oclass = g_type_class_ref(type);
 
-	    g_free(mes);
-	    g_free(params);
+	if (argumentCount > 1)
+	{
+		gchar *mes = g_strdup_printf("Constructor expects"
+									 " 1 argument, got %d", argumentCount);
+		seed_make_exception(exception, "ArgumentError", mes);
+		g_free(mes);
 
-	    return (JSObjectRef) JSValueMakeNull(eng->context);
+		return (JSObjectRef) JSValueMakeNull(eng->context);
 	}
-	// TODO: exception handling
-	jsprop_value = JSObjectGetProperty(eng->context,
-					   (JSObjectRef) arguments[0],
-					   jsprop_name, NULL);
 
-	if (g_type_is_a(param_spec->value_type, G_TYPE_ENUM))
-	    type = G_TYPE_INT;
-	else
-	    type = param_spec->value_type;
+	if (argumentCount == 1)
+	{
+		if (!JSValueIsObject(eng->context, arguments[0]))
+		{
+			seed_make_exception(exception, "ArgmuentError",
+								"Constructor expects object as argument");
+			g_type_class_unref(oclass);
+			return (JSObjectRef) JSValueMakeNull(eng->context);
+		}
 
-	seed_gvalue_from_seed_value(jsprop_value,
-				    type, &params[i].value, exception);
+		jsprops = JSObjectCopyPropertyNames(eng->context,
+											(JSObjectRef) arguments[0]);
+		nparams = JSPropertyNameArrayGetCount(jsprops);
+	}
+	i = 0;
 
-	if (*exception)
+	params = g_new0(GParameter, nparams + 1);
+	SEED_NOTE(INITIALIZATION, "Constructing object of type %s",
+			  g_type_name(type));
+
+	while (i < nparams)
 	{
+		GType type;
+		jsprop_name = JSPropertyNameArrayGetNameAtIndex(jsprops, i);
+
+		length = JSStringGetMaximumUTF8CStringSize(jsprop_name);
+		prop_name = g_malloc(length * sizeof(gchar));
+		JSStringGetUTF8CString(jsprop_name, prop_name, length);
+
+		param_spec = g_object_class_find_property(oclass, prop_name);
+		if (param_spec == NULL)
+		{
+			gchar *mes =
+				g_strdup_printf("Invalid property for construction: %s",
+								prop_name);
+			seed_make_exception(exception, "PropertyError", mes);
+
+			g_free(mes);
+			g_free(params);
+
+			return (JSObjectRef) JSValueMakeNull(eng->context);
+		}
+		// TODO: exception handling
+		jsprop_value = JSObjectGetProperty(eng->context,
+										   (JSObjectRef) arguments[0],
+										   jsprop_name, NULL);
+
+		if (g_type_is_a(param_spec->value_type, G_TYPE_ENUM))
+			type = G_TYPE_INT;
+		else
+			type = param_spec->value_type;
+
+		seed_gvalue_from_seed_value(jsprop_value,
+									type, &params[i].value, exception);
+
+		if (*exception)
+		{
 
-	    g_free(prop_name);
-	    g_free(params);
-	    return 0;
+			g_free(prop_name);
+			g_free(params);
+			return 0;
+		}
+		params[i].name = prop_name;
+
+		++i;
 	}
-	params[i].name = prop_name;
 
-	++i;
-    }
+	if (jsprops)
+		JSPropertyNameArrayRelease(jsprops);
 
-    if (jsprops)
-	JSPropertyNameArrayRelease(jsprops);
+	gobject = g_object_newv(type, nparams, params);
 
-    gobject = g_object_newv(type, nparams, params);
+	g_object_ref_sink(gobject);
 
-    g_object_ref_sink (gobject);
+	if (!gobject)
+		ret = (JSObjectRef) JSValueMakeNull(eng->context);
+	else
+		ret = (JSObjectRef) seed_value_from_object(gobject, exception);
 
-    if (!gobject)
-	ret = (JSObjectRef)JSValueMakeNull(eng->context);
-    else
-	ret = (JSObjectRef)seed_value_from_object(gobject, exception);
-    
-    g_object_unref(gobject);
+	g_object_unref(gobject);
 
-    g_type_class_unref(oclass);
+	g_type_class_unref(oclass);
 
-    g_free(params);
+	g_free(params);
 
-    return ret;
+	return ret;
 }
 
 static JSValueRef
 seed_gobject_equals(JSContextRef ctx,
-		    JSObjectRef function,
-		    JSObjectRef this_object,
-		    size_t argumentCount,
-		    const JSValueRef arguments[], JSValueRef * exception)
-{
-    GObject *this, *that;
-
-    if (argumentCount != 1)
-    {
-	gchar *mes = g_strdup_printf("GObject equals comparison expected"
-				     " 1 argument, got %d", argumentCount);
-	seed_make_exception(exception, "ArgumentError", mes);
-	g_free(mes);
+					JSObjectRef function,
+					JSObjectRef this_object,
+					size_t argumentCount,
+					const JSValueRef arguments[], JSValueRef * exception)
+{
+	GObject *this, *that;
 
-	return JSValueMakeNull(eng->context);
-    }
+	if (argumentCount != 1)
+	{
+		gchar *mes = g_strdup_printf("GObject equals comparison expected"
+									 " 1 argument, got %d", argumentCount);
+		seed_make_exception(exception, "ArgumentError", mes);
+		g_free(mes);
+
+		return JSValueMakeNull(eng->context);
+	}
 
-    this = seed_value_to_object((JSValueRef) this_object, exception);
-    that = seed_value_to_object(arguments[0], exception);
+	this = seed_value_to_object((JSValueRef) this_object, exception);
+	that = seed_value_to_object(arguments[0], exception);
 
-    if (this == that)
-	return seed_value_from_boolean(1, 0);
-    return seed_value_from_boolean(0, 0);
+	if (this == that)
+		return seed_value_from_boolean(1, 0);
+	return seed_value_from_boolean(0, 0);
 }
 
 static JSValueRef
 seed_gobject_ref_count(JSContextRef ctx,
-		    JSObjectRef function,
-		    JSObjectRef this_object,
-		    size_t argumentCount,
-		    const JSValueRef arguments[], JSValueRef * exception)
+					   JSObjectRef function,
+					   JSObjectRef this_object,
+					   size_t argumentCount,
+					   const JSValueRef arguments[], JSValueRef * exception)
 {
-    GObject *this;
+	GObject *this;
 
-    this = seed_value_to_object((JSValueRef) this_object, exception);
+	this = seed_value_to_object((JSValueRef) this_object, exception);
 
-    return seed_value_from_int(this->ref_count, exception);
+	return seed_value_from_int(this->ref_count, exception);
 }
 
 static JSValueRef
 seed_gobject_method_invoked(JSContextRef ctx,
-			    JSObjectRef function,
-			    JSObjectRef this_object,
-			    size_t argumentCount,
-			    const JSValueRef arguments[],
-			    JSValueRef * exception)
-{
-    GIBaseInfo *info;
-    GObject *object;
-    gboolean instance_method = TRUE;
-    GArgument retval;
-    GArgument *in_args;
-    GArgument *out_args;
-    GArgument *out_values;
-    gint n_args, n_in_args, n_out_args, i;
-    GIArgInfo *arg_info;
-    GITypeInfo *type_info;
-    GIDirection dir;
-    JSValueRef retval_ref;
-    GError *error = 0;
-
-    info = JSObjectGetPrivate(function);
-    // We just want to check if there IS an object, not actually throw an
-    // exception if we don't
-    // get it.
-    if (!
-	((object = seed_value_to_object(this_object, 0)) ||
-	 (object = seed_pointer_get_pointer(this_object))))
-	instance_method = FALSE;
-
-    n_args = g_callable_info_get_n_args((GICallableInfo *) info);
-
-    in_args = g_new0(GArgument, n_args + 1);
-    out_args = g_new0(GArgument, n_args + 1);
-    out_values = g_new0(GArgument, n_args + 1);
-    n_in_args = n_out_args = 0;
-
-    if (instance_method)
-	in_args[n_in_args++].v_pointer = object;
-
-    for (i = 0; (i < (n_args)); i++)
-    {
-	arg_info = g_callable_info_get_arg((GICallableInfo *) info, i);
-	dir = g_arg_info_get_direction(arg_info);
-	type_info = g_arg_info_get_type(arg_info);
-	if (i + 1 > argumentCount)
-	{
-	    in_args[n_in_args++].v_pointer = 0;
-	}
-	else if (dir == GI_DIRECTION_IN || dir == GI_DIRECTION_INOUT)
-	{
-
-	    if (!seed_gi_make_argument(arguments[i],
-				       type_info,
-				       &in_args[n_in_args++], exception))
-	    {
-		gchar *mes =
-		    g_strdup_printf
-		    ("Unable to make argument %d for" " function: %s. \n",
-		     i + 1,
-		     g_base_info_get_name((GIBaseInfo *) info));
-		seed_make_exception(exception, "ArgumentError", mes);
+							JSObjectRef function,
+							JSObjectRef this_object,
+							size_t argumentCount,
+							const JSValueRef arguments[],
+							JSValueRef * exception)
+{
+	GIBaseInfo *info;
+	GObject *object;
+	gboolean instance_method = TRUE;
+	GArgument retval;
+	GArgument *in_args;
+	GArgument *out_args;
+	GArgument *out_values;
+	gint n_args, n_in_args, n_out_args, i;
+	GIArgInfo *arg_info;
+	GITypeInfo *type_info;
+	GIDirection dir;
+	JSValueRef retval_ref;
+	GError *error = 0;
+
+	info = JSObjectGetPrivate(function);
+	// We just want to check if there IS an object, not actually throw an
+	// exception if we don't
+	// get it.
+	if (!
+		((object = seed_value_to_object(this_object, 0)) ||
+		 (object = seed_pointer_get_pointer(this_object))))
+		instance_method = FALSE;
+
+	n_args = g_callable_info_get_n_args((GICallableInfo *) info);
+
+	in_args = g_new0(GArgument, n_args + 1);
+	out_args = g_new0(GArgument, n_args + 1);
+	out_values = g_new0(GArgument, n_args + 1);
+	n_in_args = n_out_args = 0;
+
+	if (instance_method)
+		in_args[n_in_args++].v_pointer = object;
+
+	for (i = 0; (i < (n_args)); i++)
+	{
+		arg_info = g_callable_info_get_arg((GICallableInfo *) info, i);
+		dir = g_arg_info_get_direction(arg_info);
+		type_info = g_arg_info_get_type(arg_info);
+		if (i + 1 > argumentCount)
+		{
+			in_args[n_in_args++].v_pointer = 0;
+		}
+		else if (dir == GI_DIRECTION_IN || dir == GI_DIRECTION_INOUT)
+		{
+
+			if (!seed_gi_make_argument(arguments[i],
+									   type_info,
+									   &in_args[n_in_args++], exception))
+			{
+				gchar *mes =
+					g_strdup_printf
+					("Unable to make argument %d for" " function: %s. \n",
+					 i + 1,
+					 g_base_info_get_name((GIBaseInfo *) info));
+				seed_make_exception(exception, "ArgumentError", mes);
+
+				g_free(mes);
+				g_base_info_unref((GIBaseInfo *) type_info);
+				g_base_info_unref((GIBaseInfo *) arg_info);
+				g_free(in_args);
+				g_free(out_args);
+
+				return JSValueMakeNull(eng->context);
+			}
+			if (dir == GI_DIRECTION_INOUT)
+			{
+				GArgument *out_value = &out_values[n_out_args];
+				out_args[n_out_args++].v_pointer = out_value;
+			}
+
+		}
+		else if (dir == GI_DIRECTION_OUT)
+		{
+			GArgument *out_value = &out_values[n_out_args];
+			out_args[n_out_args++].v_pointer = out_value;
+		}
 
-		g_free(mes);
 		g_base_info_unref((GIBaseInfo *) type_info);
 		g_base_info_unref((GIBaseInfo *) arg_info);
+	}
+	SEED_NOTE(INVOCATION, "Invoking method: %s with %d in arguments"
+			  " and %d out arguments",
+			  g_base_info_get_name(info), n_in_args, n_out_args);
+	if (g_function_info_invoke((GIFunctionInfo *) info,
+							   in_args,
+							   n_in_args,
+							   out_args, n_out_args, &retval, &error))
+	{
+		GITypeTag tag;
+
+		type_info = g_callable_info_get_return_type((GICallableInfo *) info);
+		tag = g_type_info_get_tag(type_info);
+		if (tag == GI_TYPE_TAG_VOID)
+			retval_ref = JSValueMakeNull(eng->context);
+		else
+		{
+			GIBaseInfo *interface;
+			GIInfoType type;
+
+			if (tag == GI_TYPE_TAG_INTERFACE)
+			{
+				GIFunctionInfoFlags flags =
+					g_function_info_get_flags((GIFunctionInfo *) info);
+
+				if (flags & GI_FUNCTION_IS_CONSTRUCTOR)
+				{
+					GIBaseInfo *interface;
+					GIInfoType interface_type;
+
+					interface = g_type_info_get_interface(type_info);
+					interface_type = g_base_info_get_type(interface);
+					g_base_info_unref(interface);
+
+					if (interface_type == GI_INFO_TYPE_OBJECT ||
+						interface_type == GI_INFO_TYPE_INTERFACE)
+					{
+						if (G_IS_OBJECT(retval.v_pointer))
+							g_object_ref_sink(G_OBJECT(retval.v_pointer));
+					}
+
+				}
+			}
+
+			retval_ref =
+				seed_gi_argument_make_js(&retval, type_info, exception);
+
+			seed_gi_release_arg(g_callable_info_get_caller_owns((GICallableInfo
+																 *) info),
+								type_info, &retval);
+		}
+		g_base_info_unref((GIBaseInfo *) type_info);
+	}
+	else
+	{
+		seed_make_exception_from_gerror(exception, error);
+
 		g_free(in_args);
 		g_free(out_args);
+		g_error_free(error);
 
 		return JSValueMakeNull(eng->context);
-	    }
-	    if (dir == GI_DIRECTION_INOUT)
-	    {
-		GArgument *out_value = &out_values[n_out_args];
-		out_args[n_out_args++].v_pointer = out_value;
-	    }
-
-	}
-	else if (dir == GI_DIRECTION_OUT)
-	{
-	    GArgument *out_value = &out_values[n_out_args];
-	    out_args[n_out_args++].v_pointer = out_value;
-	}
-
-	g_base_info_unref((GIBaseInfo *) type_info);
-	g_base_info_unref((GIBaseInfo *) arg_info);
-    }
-    SEED_NOTE(INVOCATION, "Invoking method: %s with %d in arguments"
-	      " and %d out arguments",
-	      g_base_info_get_name(info),
-	      n_in_args,
-	      n_out_args);
-    if (g_function_info_invoke((GIFunctionInfo *) info,
-			       in_args,
-			       n_in_args,
-			       out_args, n_out_args, &retval, &error))
-    {
-	GITypeTag tag;
-
-	type_info = g_callable_info_get_return_type((GICallableInfo *) info);
-	tag = g_type_info_get_tag(type_info);
-	if (tag == GI_TYPE_TAG_VOID)
-	    retval_ref = JSValueMakeNull(eng->context);
-	else
+	}
+	for (i = 0; (i < n_args); i++)
 	{
-	    GIBaseInfo * interface;
-	    GIInfoType type;
+		JSValueRef jsout_val;
+		arg_info = g_callable_info_get_arg((GICallableInfo *) info, i);
+		dir = g_arg_info_get_direction(arg_info);
+		type_info = g_arg_info_get_type(arg_info);
 
-	    if (tag == GI_TYPE_TAG_INTERFACE)
-	    {
-		GIFunctionInfoFlags flags = 
-		    g_function_info_get_flags((GIFunctionInfo *) info);
-		
-		if (flags & GI_FUNCTION_IS_CONSTRUCTOR)
-		{
-		    GIBaseInfo * interface;
-		    GIInfoType interface_type;
-		    
-		    interface = g_type_info_get_interface(type_info);
-		    interface_type = g_base_info_get_type(interface);
-		    g_base_info_unref(interface);
-		    
-		    if (interface_type == GI_INFO_TYPE_OBJECT ||
-			interface_type == GI_INFO_TYPE_INTERFACE)
-		    {
-			if (G_IS_OBJECT(retval.v_pointer))
-			    g_object_ref_sink(G_OBJECT(retval.v_pointer));
-		    }
-
-		}
-	    }
-
-	    
-	    retval_ref =
-		seed_gi_argument_make_js(&retval, type_info, exception);
-	    
-	    seed_gi_release_arg(g_callable_info_get_caller_owns(
-				    (GICallableInfo *)info),
-							     type_info,
-							     &retval);
-	}
-	g_base_info_unref((GIBaseInfo *) type_info);
-    }
-    else
-    {
-	seed_make_exception_from_gerror(exception, error);
+		if (dir == GI_DIRECTION_IN)
+		{
+			seed_gi_release_in_arg(g_arg_info_get_ownership_transfer(arg_info),
+								   type_info,
+								   &in_args[i + (instance_method ? 1 : 0)]);
+
+			g_base_info_unref((GIBaseInfo *) type_info);
+			g_base_info_unref((GIBaseInfo *) arg_info);
+			continue;
+		}
+		jsout_val = seed_gi_argument_make_js(&out_values[i],
+											 type_info, exception);
+		if (!JSValueIsNull(eng->context, arguments[i]) &&
+			JSValueIsObject(eng->context, arguments[i]))
+		{
+			seed_object_set_property((JSObjectRef) arguments[i],
+									 "value", jsout_val);
+		}
+
+		g_base_info_unref((GIBaseInfo *) arg_info);
+		g_base_info_unref((GIBaseInfo *) type_info);
+	}
 
 	g_free(in_args);
 	g_free(out_args);
-	g_error_free(error);
-
-	return JSValueMakeNull(eng->context);
-    }
-    for (i = 0;	 (i < n_args);	 i++)
-    {
-	JSValueRef jsout_val;
-	arg_info = g_callable_info_get_arg((GICallableInfo *) info, i);
-	dir = g_arg_info_get_direction(arg_info);
-	type_info = g_arg_info_get_type(arg_info);
-	
-	if (dir == GI_DIRECTION_IN)
-	{
-	    seed_gi_release_in_arg(
-		g_arg_info_get_ownership_transfer(arg_info),
-		type_info,
-	        &in_args[i+(instance_method ? 1 : 0)]);
-	    
-	    g_base_info_unref((GIBaseInfo *) type_info);
-	    g_base_info_unref((GIBaseInfo *) arg_info);
-	    continue;
-	}
-	jsout_val = seed_gi_argument_make_js(&out_values[i],
-					     type_info, exception);
-	if (!JSValueIsNull(eng->context, arguments[i]) &&
-	    JSValueIsObject(eng->context, arguments[i]))
-	{
-	    seed_object_set_property((JSObjectRef) arguments[i],
-				     "value", jsout_val);
-	}
-	
-	g_base_info_unref((GIBaseInfo *) arg_info);
-	g_base_info_unref((GIBaseInfo *) type_info);
-    }
-
-
-    g_free(in_args);
-    g_free(out_args);
-    g_free(out_values);
-    return retval_ref;
+	g_free(out_values);
+	return retval_ref;
 }
 
 void
 seed_gobject_define_property_from_function_info(GIFunctionInfo * info,
-						JSObjectRef object,
-						gboolean instance)
+												JSObjectRef object,
+												gboolean instance)
 {
-    GIFunctionInfoFlags flags;
-    JSValueRef method_ref;
-    const gchar *name;
-
-    // if (g_base_info_is_deprecated ((GIBaseInfo *) info))
-    // g_printf("Not defining deprecated symbol: %s \n",
-    // g_base_info_get_name((GIBaseInfo *)info));
-
-    flags = g_function_info_get_flags(info);
-
-    if (instance && (flags & GI_FUNCTION_IS_CONSTRUCTOR))
-    {
-	return;
-    }
-
-    method_ref = JSObjectMake(eng->context, gobject_method_class, info);
-
-    name = g_base_info_get_name((GIBaseInfo *) info);
-    if (!strcmp(name, "new"))
-	name = "_new";
-    seed_object_set_property(object, name, method_ref);
+	GIFunctionInfoFlags flags;
+	JSValueRef method_ref;
+	const gchar *name;
+
+	// if (g_base_info_is_deprecated ((GIBaseInfo *) info))
+	// g_printf("Not defining deprecated symbol: %s \n",
+	// g_base_info_get_name((GIBaseInfo *)info));
+
+	flags = g_function_info_get_flags(info);
+
+	if (instance && (flags & GI_FUNCTION_IS_CONSTRUCTOR))
+	{
+		return;
+	}
+
+	method_ref = JSObjectMake(eng->context, gobject_method_class, info);
+
+	name = g_base_info_get_name((GIBaseInfo *) info);
+	if (!strcmp(name, "new"))
+		name = "_new";
+	seed_object_set_property(object, name, method_ref);
 
 }
 
 static void
 seed_gobject_add_methods_for_interfaces(GIObjectInfo * oinfo,
-					JSObjectRef object)
+										JSObjectRef object)
 {
-    GIInterfaceInfo *interface;
-    gint n_interfaces, i;
+	GIInterfaceInfo *interface;
+	gint n_interfaces, i;
 
-    n_interfaces = g_object_info_get_n_interfaces(oinfo);
+	n_interfaces = g_object_info_get_n_interfaces(oinfo);
 
-    for (i = 0; i < n_interfaces; i++)
-    {
-	GIFunctionInfo *function;
-	gint n_functions, k;
-	interface = g_object_info_get_interface(oinfo, i);
-
-	n_functions = g_interface_info_get_n_methods(interface);
-	for (k = 0; k < n_functions; k++)
+	for (i = 0; i < n_interfaces; i++)
 	{
-	    function = g_interface_info_get_method(interface, k);
-	    seed_gobject_define_property_from_function_info
-		(function, object, TRUE);
+		GIFunctionInfo *function;
+		gint n_functions, k;
+		interface = g_object_info_get_interface(oinfo, i);
+
+		n_functions = g_interface_info_get_n_methods(interface);
+		for (k = 0; k < n_functions; k++)
+		{
+			function = g_interface_info_get_method(interface, k);
+			seed_gobject_define_property_from_function_info
+				(function, object, TRUE);
+		}
+		// g_base_info_unref((GIBaseInfo*)interface);
 	}
-	// g_base_info_unref((GIBaseInfo*)interface);
-    }
 }
 
 static void
 seed_gobject_add_methods_for_type(GIObjectInfo * oinfo, JSObjectRef object)
 {
-    gint n_methods;
-    gint i;
-    GIFunctionInfo *info;
-
-    n_methods = g_object_info_get_n_methods(oinfo);
-
-    for (i = 0; i < n_methods; i++)
-    {
-	info = g_object_info_get_method(oinfo, i);
-	seed_gobject_define_property_from_function_info(info, object, TRUE);
-    }
+	gint n_methods;
+	gint i;
+	GIFunctionInfo *info;
+
+	n_methods = g_object_info_get_n_methods(oinfo);
+
+	for (i = 0; i < n_methods; i++)
+	{
+		info = g_object_info_get_method(oinfo, i);
+		seed_gobject_define_property_from_function_info(info, object, TRUE);
+	}
 }
 
 JSClassRef seed_gobject_get_class_for_gtype(GType type)
 {
-    JSClassDefinition def;
-    GType parent;
-    JSClassRef ref;
-    JSClassRef parent_class = 0;
-    GIBaseInfo *info;
-    JSObjectRef prototype_obj;
-    JSObjectRef parent_prototype;
+	JSClassDefinition def;
+	GType parent;
+	JSClassRef ref;
+	JSClassRef parent_class = 0;
+	GIBaseInfo *info;
+	JSObjectRef prototype_obj;
+	JSObjectRef parent_prototype;
 
-    if ((ref = g_type_get_qdata(type, qname)) != NULL)
-    {
-	return ref;
-    }
+	if ((ref = g_type_get_qdata(type, qname)) != NULL)
+	{
+		return ref;
+	}
 
-    info = g_irepository_find_by_gtype(g_irepository_get_default(), type);
+	info = g_irepository_find_by_gtype(g_irepository_get_default(), type);
 
-    memset(&def, 0, sizeof(JSClassDefinition));
+	memset(&def, 0, sizeof(JSClassDefinition));
 
-    def.className = g_type_name(type);
-    if ((parent = g_type_parent(type)))
-	parent_class = seed_gobject_get_class_for_gtype(parent);
-    def.parentClass = parent_class;
-    def.attributes = kJSClassAttributeNoAutomaticPrototype;
-
-    prototype_obj = JSObjectMake(eng->context, 0, 0);
-    if (parent)
-    {
-	parent_prototype = seed_gobject_get_prototype_for_gtype(parent);
-	if (parent_prototype)
-	    JSObjectSetPrototype(eng->context, prototype_obj, parent_prototype);
-    }
-
-    ref = JSClassCreate(&def);
-    JSClassRetain(ref);
-
-    JSValueProtect(eng->context, prototype_obj);
-
-    g_type_set_qdata(type, qname, ref);
-    g_type_set_qdata(type, qprototype, prototype_obj);
-
-    if (info && (g_base_info_get_type(info) == GI_INFO_TYPE_OBJECT))
-    {
-	seed_gobject_add_methods_for_type((GIObjectInfo *) info, prototype_obj);
-	seed_gobject_add_methods_for_interfaces((GIObjectInfo *) info,
-						prototype_obj);
-    }
-    else
-    {
-	GType *interfaces;
-	GIFunctionInfo *function;
-	GIBaseInfo *interface;
-	gint n_functions, k, i, n;
+	def.className = g_type_name(type);
+	if ((parent = g_type_parent(type)))
+		parent_class = seed_gobject_get_class_for_gtype(parent);
+	def.parentClass = parent_class;
+	def.attributes = kJSClassAttributeNoAutomaticPrototype;
 
-	interfaces = g_type_interfaces(type, &n);
-	for (i = 0; i < n; i++)
+	prototype_obj = JSObjectMake(eng->context, 0, 0);
+	if (parent)
+	{
+		parent_prototype = seed_gobject_get_prototype_for_gtype(parent);
+		if (parent_prototype)
+			JSObjectSetPrototype(eng->context, prototype_obj, parent_prototype);
+	}
+
+	ref = JSClassCreate(&def);
+	JSClassRetain(ref);
+
+	JSValueProtect(eng->context, prototype_obj);
+
+	g_type_set_qdata(type, qname, ref);
+	g_type_set_qdata(type, qprototype, prototype_obj);
+
+	if (info && (g_base_info_get_type(info) == GI_INFO_TYPE_OBJECT))
+	{
+		seed_gobject_add_methods_for_type((GIObjectInfo *) info, prototype_obj);
+		seed_gobject_add_methods_for_interfaces((GIObjectInfo *) info,
+												prototype_obj);
+	}
+	else
 	{
-	    interface = g_irepository_find_by_gtype(0, interfaces[i]);
-	    if (!interface)
-		break;
-	    n_functions =
-		g_interface_info_get_n_methods((GIInterfaceInfo *) interface);
-	    for (k = 0; k < n_functions; k++)
-	    {
-		function =
-		    g_interface_info_get_method((GIInterfaceInfo
-						 *) interface, k);
-		seed_gobject_define_property_from_function_info
-		    (function, prototype_obj, TRUE);
-	    }
+		GType *interfaces;
+		GIFunctionInfo *function;
+		GIBaseInfo *interface;
+		gint n_functions, k, i, n;
+
+		interfaces = g_type_interfaces(type, &n);
+		for (i = 0; i < n; i++)
+		{
+			interface = g_irepository_find_by_gtype(0, interfaces[i]);
+			if (!interface)
+				break;
+			n_functions =
+				g_interface_info_get_n_methods((GIInterfaceInfo *) interface);
+			for (k = 0; k < n_functions; k++)
+			{
+				function =
+					g_interface_info_get_method((GIInterfaceInfo
+												 *) interface, k);
+				seed_gobject_define_property_from_function_info
+					(function, prototype_obj, TRUE);
+			}
+		}
 	}
-    }
 
-    return ref;
+	return ref;
 }
 
 JSObjectRef seed_gobject_get_prototype_for_gtype(GType type)
 {
-    JSObjectRef prototype = 0;
-    while (type && !prototype)
-    {
-	prototype = g_type_get_qdata(type, qprototype);
-	type = g_type_parent(type);
-    }
+	JSObjectRef prototype = 0;
+	while (type && !prototype)
+	{
+		prototype = g_type_get_qdata(type, qprototype);
+		type = g_type_parent(type);
+	}
 
-    return prototype;
+	return prototype;
 }
 
 static void seed_gobject_finalize(JSObjectRef object)
 {
-    GObject *gobject;
+	GObject *gobject;
+
+	gobject = seed_value_to_object((JSValueRef) object, 0);
+	if (!gobject)
+	{
+		SEED_NOTE(FINALIZATION,
+				  "Attempting to finalize already destroyed object.");
+		return;
+	}
 
-    gobject = seed_value_to_object((JSValueRef) object, 0);
-    if (!gobject)
-    {
-        SEED_NOTE(FINALIZATION,
-            "Attempting to finalize already destroyed object.");
-	    return;
-	}
-	
-    SEED_NOTE(FINALIZATION, "%s at %p (%d refs)", 
-        g_type_name(G_OBJECT_TYPE(gobject)),
-        gobject,
-        gobject->ref_count);
-    
-    g_object_set_data_full (gobject, "js-ref", NULL, NULL);
+	SEED_NOTE(FINALIZATION, "%s at %p (%d refs)",
+			  g_type_name(G_OBJECT_TYPE(gobject)), gobject, gobject->ref_count);
 
-    g_object_remove_toggle_ref(gobject, seed_toggle_ref, 0);
-    g_object_run_dispose(gobject);
+	g_object_set_data_full(gobject, "js-ref", NULL, NULL);
+
+	g_object_remove_toggle_ref(gobject, seed_toggle_ref, 0);
+	g_object_run_dispose(gobject);
 }
 
 static void seed_gobject_initialize(JSContextRef ctx, JSObjectRef object)
 {
-    GObject *gobject;
-    GIBaseInfo *base;
+	GObject *gobject;
+	GIBaseInfo *base;
 
-    gobject = seed_value_to_object((JSValueRef) object, 0);
-    if (!gobject)
-        return;
+	gobject = seed_value_to_object((JSValueRef) object, 0);
+	if (!gobject)
+		return;
 
-    base = g_irepository_find_by_gtype(g_irepository_get_default(),
-				       G_OBJECT_TYPE(gobject));
+	base = g_irepository_find_by_gtype(g_irepository_get_default(),
+									   G_OBJECT_TYPE(gobject));
 
-    seed_add_signals_to_object(object, gobject);
-    if (!base)
-	    return;
+	seed_add_signals_to_object(object, gobject);
+	if (!base)
+		return;
 
-    g_assert(g_base_info_get_type(base) == GI_INFO_TYPE_OBJECT);
+	g_assert(g_base_info_get_type(base) == GI_INFO_TYPE_OBJECT);
 }
 
 static JSValueRef
 seed_gobject_get_property(JSContextRef context,
-			  JSObjectRef object,
-			  JSStringRef property_name, JSValueRef * exception)
+						  JSObjectRef object,
+						  JSStringRef property_name, JSValueRef * exception)
 {
-    GParamSpec *spec;
-    GObject *b;
-    GValue gval = { 0 };
-    char *cproperty_name;
-    gint length;
-    JSValueRef ret;
-    gint i, len;
-
-    b = seed_value_to_object((JSValueRef) object, exception);
-    if (!b)
-	return 0;
-
-    length = JSStringGetMaximumUTF8CStringSize(property_name);
-    cproperty_name = g_malloc(length * sizeof(gchar));
-    JSStringGetUTF8CString(property_name, cproperty_name, length);
-
-    spec = g_object_class_find_property(G_OBJECT_GET_CLASS(b), cproperty_name);
-
-    if (!spec)
-    {
-							    
-	len = strlen(cproperty_name);
-	for (i = 0; i < len - 1; i++)
-	{
-	    if (cproperty_name[i] == '_')
-		cproperty_name[i] = '-';
-	}
-	spec = g_object_class_find_property(G_OBJECT_GET_CLASS(b),
-					    cproperty_name);
-	if (spec)
-	    goto found;
-	else
-	{
-	    GIFieldInfo * field;
-	    GIBaseInfo * info = (GIBaseInfo *)
-		g_irepository_find_by_gtype(0, G_OBJECT_TYPE(b));
-	    gint n;
-	    const gchar * name;
-
-	    for (i = 0; i < len - 1; i++)
-	    {
-		if (cproperty_name[i] == '-')
-		    cproperty_name[i] = '_';
-	    }
-	    
-	    if (!info)
-	    {
-		g_free(cproperty_name);
+	GParamSpec *spec;
+	GObject *b;
+	GValue gval = { 0 };
+	char *cproperty_name;
+	gint length;
+	JSValueRef ret;
+	gint i, len;
+
+	b = seed_value_to_object((JSValueRef) object, exception);
+	if (!b)
 		return 0;
-	    }
-	    
-	    n = g_object_info_get_n_fields((GIObjectInfo *)info);
-	    for (i = 0; i < n; i++)
-	    {
-		field = g_object_info_get_field((GIObjectInfo *)info, i);
-		name = g_base_info_get_name((GIBaseInfo *) field);
 
-		if (!strcmp(name, cproperty_name))
-		    goto found_field;
-		else
+	length = JSStringGetMaximumUTF8CStringSize(property_name);
+	cproperty_name = g_malloc(length * sizeof(gchar));
+	JSStringGetUTF8CString(property_name, cproperty_name, length);
+
+	spec = g_object_class_find_property(G_OBJECT_GET_CLASS(b), cproperty_name);
+
+	if (!spec)
+	{
+
+		len = strlen(cproperty_name);
+		for (i = 0; i < len - 1; i++)
 		{
-		    g_base_info_unref((GIBaseInfo *) field);
-		    field = 0;
+			if (cproperty_name[i] == '_')
+				cproperty_name[i] = '-';
 		}
-	    }
-	found_field:
-	    if (field)
-	    {
-		GArgument field_value;
-		GITypeInfo * field_type = g_field_info_get_type(field);
-		if (g_field_info_get_field(field, b,
-					   &field_value))
-		{
-		    ret = seed_gi_argument_make_js(&field_value,
-					     field_type,
-					     exception);
-		    
-		    g_base_info_unref((GIBaseInfo *) info);
-		    
-		    g_free(cproperty_name);
-		    return ret;
+		spec = g_object_class_find_property(G_OBJECT_GET_CLASS(b),
+											cproperty_name);
+		if (spec)
+			goto found;
+		else
+		{
+			GIFieldInfo *field;
+			GIBaseInfo *info = (GIBaseInfo *)
+				g_irepository_find_by_gtype(0, G_OBJECT_TYPE(b));
+			gint n;
+			const gchar *name;
+
+			for (i = 0; i < len - 1; i++)
+			{
+				if (cproperty_name[i] == '-')
+					cproperty_name[i] = '_';
+			}
+
+			if (!info)
+			{
+				g_free(cproperty_name);
+				return 0;
+			}
+
+			n = g_object_info_get_n_fields((GIObjectInfo *) info);
+			for (i = 0; i < n; i++)
+			{
+				field = g_object_info_get_field((GIObjectInfo *) info, i);
+				name = g_base_info_get_name((GIBaseInfo *) field);
+
+				if (!strcmp(name, cproperty_name))
+					goto found_field;
+				else
+				{
+					g_base_info_unref((GIBaseInfo *) field);
+					field = 0;
+				}
+			}
+ found_field:
+			if (field)
+			{
+				GArgument field_value;
+				GITypeInfo *field_type = g_field_info_get_type(field);
+				if (g_field_info_get_field(field, b, &field_value))
+				{
+					ret = seed_gi_argument_make_js(&field_value,
+												   field_type, exception);
+
+					g_base_info_unref((GIBaseInfo *) info);
+
+					g_free(cproperty_name);
+					return ret;
+				}
+			}
+			g_base_info_unref((GIBaseInfo *) info);
 		}
-	    }
-	    g_base_info_unref((GIBaseInfo*)info);
+		g_free(cproperty_name);
+		return 0;
 	}
-	g_free(cproperty_name);
-	return 0;
-    }
-found:
-
-    g_value_init(&gval, spec->value_type);
-    g_object_get_property(b, cproperty_name, &gval);
-    ret = seed_value_from_gvalue(&gval, exception);
-    g_value_unset(&gval);
+ found:
+
+	g_value_init(&gval, spec->value_type);
+	g_object_get_property(b, cproperty_name, &gval);
+	ret = seed_value_from_gvalue(&gval, exception);
+	g_value_unset(&gval);
 
-    g_free(cproperty_name);
-    return (JSValueRef) ret;
+	g_free(cproperty_name);
+	return (JSValueRef) ret;
 }
 
 static bool
 seed_gobject_set_property(JSContextRef context,
-			  JSObjectRef object,
-			  JSStringRef property_name,
-			  JSValueRef value, JSValueRef * exception)
-{
-    GParamSpec *spec = 0;
-    GObject *obj;
-    GValue gval = { 0 };
-    GType type;
-    gchar *cproperty_name;
-    gint length;
-
-    if (JSValueIsNull(eng->context, value))
-	return 0;
-
-    obj = seed_value_to_object(object, 0);
-
-    length = JSStringGetMaximumUTF8CStringSize(property_name);
-    cproperty_name = g_malloc(length * sizeof(gchar));
-    JSStringGetUTF8CString(property_name, cproperty_name, length);
+						  JSObjectRef object,
+						  JSStringRef property_name,
+						  JSValueRef value, JSValueRef * exception)
+{
+	GParamSpec *spec = 0;
+	GObject *obj;
+	GValue gval = { 0 };
+	GType type;
+	gchar *cproperty_name;
+	gint length;
 
-    spec = g_object_class_find_property(G_OBJECT_GET_CLASS(obj),
-					cproperty_name);
+	if (JSValueIsNull(eng->context, value))
+		return 0;
+
+	obj = seed_value_to_object(object, 0);
+
+	length = JSStringGetMaximumUTF8CStringSize(property_name);
+	cproperty_name = g_malloc(length * sizeof(gchar));
+	JSStringGetUTF8CString(property_name, cproperty_name, length);
 
-    if (!spec)
-    {
-	gint i, len;
-	len = strlen(cproperty_name);
-	for (i = 0; i < len; i++)
-	{
-	    if (cproperty_name[i] == '_')
-		cproperty_name[i] = '-';
-	}
 	spec = g_object_class_find_property(G_OBJECT_GET_CLASS(obj),
-					    cproperty_name);
+										cproperty_name);
+
 	if (!spec)
 	{
-	    g_free(cproperty_name);
-	    return 0;
+		gint i, len;
+		len = strlen(cproperty_name);
+		for (i = 0; i < len; i++)
+		{
+			if (cproperty_name[i] == '_')
+				cproperty_name[i] = '-';
+		}
+		spec = g_object_class_find_property(G_OBJECT_GET_CLASS(obj),
+											cproperty_name);
+		if (!spec)
+		{
+			g_free(cproperty_name);
+			return 0;
+		}
 	}
-    }
 
-    if (g_type_is_a(spec->value_type, G_TYPE_ENUM))
-	type = G_TYPE_INT;
-    else
-	type = spec->value_type;
-
-    seed_gvalue_from_seed_value(value, type, &gval, exception);
-    if (*exception)
-    {
-	g_free(cproperty_name);
-	return 0;
-    }
+	if (g_type_is_a(spec->value_type, G_TYPE_ENUM))
+		type = G_TYPE_INT;
+	else
+		type = spec->value_type;
+
+	seed_gvalue_from_seed_value(value, type, &gval, exception);
+	if (*exception)
+	{
+		g_free(cproperty_name);
+		return 0;
+	}
 
-    if (glib_message)
-    {
-	g_free(glib_message);
-	glib_message = 0;
-    }
-    g_object_set_property(obj, cproperty_name, &gval);
-    if (glib_message != 0)
-    {
-	seed_make_exception(exception, "PropertyError", glib_message);
-
-	return FALSE;
-    }
-    
-    g_free(cproperty_name);
-    g_value_unset(&gval);
+	if (glib_message)
+	{
+		g_free(glib_message);
+		glib_message = 0;
+	}
+	g_object_set_property(obj, cproperty_name, &gval);
+	if (glib_message != 0)
+	{
+		seed_make_exception(exception, "PropertyError", glib_message);
 
-    return TRUE;
+		return FALSE;
+	}
+
+	g_free(cproperty_name);
+	g_value_unset(&gval);
+
+	return TRUE;
 }
 
 static JSValueRef
 seed_gi_import_namespace(JSContextRef ctx,
-			 JSObjectRef function,
-			 JSObjectRef this_object,
-			 size_t argumentCount,
-			 const JSValueRef arguments[], JSValueRef * exception)
-{
-    GIBaseInfo *info;
-    GError *e = 0;
-    const gchar *namespace;
-    const gchar *extension;
-    const gchar *version = 0;
-    JSObjectRef namespace_ref;
-    JSStringRef extension_script;
-    gint n, i;
-
-    if (argumentCount == 0)
-    {
-	seed_make_exception(exception,
-			    "ArgumentError",
-			    "Seed.import_namespace"
-			    " expected 1 or 2 arguments, got 0");
-	return JSValueMakeNull(eng->context);
-    }
+						 JSObjectRef function,
+						 JSObjectRef this_object,
+						 size_t argumentCount,
+						 const JSValueRef arguments[], JSValueRef * exception)
+{
+	GIBaseInfo *info;
+	GError *e = 0;
+	const gchar *namespace;
+	const gchar *extension;
+	const gchar *version = 0;
+	JSObjectRef namespace_ref;
+	JSStringRef extension_script;
+	gint n, i;
+
+	if (argumentCount == 0)
+	{
+		seed_make_exception(exception,
+							"ArgumentError",
+							"Seed.import_namespace"
+							" expected 1 or 2 arguments, got 0");
+		return JSValueMakeNull(eng->context);
+	}
 
-    namespace = seed_value_to_string(arguments[0], exception);
-    if (argumentCount == 2)
-    {
-	version = seed_value_to_string(arguments[1], exception);
-    }
-
-    if (!g_irepository_require(g_irepository_get_default(), namespace,
-			       version, 0, &e))
-    {
-	seed_make_exception_from_gerror(exception, e);
-	return JSValueMakeNull(eng->context);
-    }
+	namespace = seed_value_to_string(arguments[0], exception);
+	if (argumentCount == 2)
+	{
+		version = seed_value_to_string(arguments[1], exception);
+	}
 
-    n = g_irepository_get_n_infos(g_irepository_get_default(), namespace);
+	if (!g_irepository_require(g_irepository_get_default(), namespace,
+							   version, 0, &e))
+	{
+		seed_make_exception_from_gerror(exception, e);
+		return JSValueMakeNull(eng->context);
+	}
 
-    namespace_ref = JSObjectMake(eng->context, NULL, NULL);
-    JSValueProtect(eng->context, namespace_ref);
-    seed_object_set_property(eng->global, namespace, namespace_ref);
-
-    for (i = 0; i < n; i++)
-    {
-	info = g_irepository_get_info(g_irepository_get_default(),
-				      namespace, i);
-	if (info && (g_base_info_get_type(info) == GI_INFO_TYPE_FUNCTION))
-	{
-	    seed_gobject_define_property_from_function_info((GIFunctionInfo *)
-							    info, namespace_ref,
-							    FALSE);
-	}
-	else if (info
-		 && (g_base_info_get_type(info) == GI_INFO_TYPE_ENUM
-		     || g_base_info_get_type(info) == GI_INFO_TYPE_FLAGS))
-	{
-	    gint num_vals = g_enum_info_get_n_values((GIEnumInfo *) info);
-	    gint j;
-	    JSObjectRef enum_class = JSObjectMake(eng->context,
-						  0, 0);
-	    JSValueProtect(eng->context, (JSValueRef) enum_class);
-	    seed_object_set_property(namespace_ref,
-				    g_base_info_get_name(info), enum_class);
-
-	    for (j = 0; j < num_vals; j++)
-	    {
-		GIValueInfo *val =
-		    g_enum_info_get_value((GIEnumInfo *) info, j);
-		gint value = g_value_info_get_value(val);
-		gchar *name =
-		    g_strdup(g_base_info_get_name((GIBaseInfo *) val));
-		gint name_len = strlen(name);
-		gint j;
-		JSValueRef value_ref;
-
-		value_ref = JSValueMakeNumber(eng->context, value);
-		JSValueProtect(eng->context, (JSValueRef) value_ref);
-
-		for (j = 0; j < name_len; j++)
-		{
-		    if (name[j] == '-')
-			name[j] = '_';
-		}
-
-		seed_object_set_property(enum_class, name, value_ref);
-
-		g_free(name);
-
-	    }
-	}
-	else if (info && (g_base_info_get_type(info) == GI_INFO_TYPE_OBJECT))
-	{
-	    GType type;
-	    JSClassRef class_ref;
-
-	    type =
-		g_registered_type_info_get_g_type((GIRegisteredTypeInfo *)
-						  info);
-
-	    if (type != 0)
-	    {
-		JSObjectRef constructor_ref;
-		gint i, n_methods;
-		GIFunctionInfo *finfo;
-		GIFunctionInfoFlags flags;
-
-		class_ref = seed_gobject_get_class_for_gtype(type);
-
-		constructor_ref =
-		    JSObjectMake(eng->context,
-				 gobject_constructor_class, (gpointer) type);
-		
-		seed_object_set_property(constructor_ref, 
-					"type", 
-					seed_value_from_int(type, exception));
-
-		n_methods = g_object_info_get_n_methods((GIObjectInfo *) info);
-		for (i = 0; i < n_methods; i++)
-		{
-		    finfo = g_object_info_get_method((GIObjectInfo *) info, i);
-		    flags = g_function_info_get_flags(finfo);
-		    if (flags & GI_FUNCTION_IS_CONSTRUCTOR)
-		    {
-			seed_gobject_define_property_from_function_info
-			    (finfo, constructor_ref, FALSE);
-		    }
-		    else
-		    {
-			g_base_info_unref((GIBaseInfo *) finfo);
-		    }
-		}
+	n = g_irepository_get_n_infos(g_irepository_get_default(), namespace);
 
-		seed_object_set_property(namespace_ref,
-					g_base_info_get_name
-					(info), constructor_ref);
-		JSValueProtect(eng->context, (JSValueRef) constructor_ref);
-	    }
-	}
-	else if (info && (g_base_info_get_type(info) == GI_INFO_TYPE_STRUCT))
+	namespace_ref = JSObjectMake(eng->context, NULL, NULL);
+	JSValueProtect(eng->context, namespace_ref);
+	seed_object_set_property(eng->global, namespace, namespace_ref);
+
+	for (i = 0; i < n; i++)
 	{
-	    JSObjectRef struct_ref;
-	    gint i, n_methods;
-	    GIFunctionInfo *finfo;
+		info = g_irepository_get_info(g_irepository_get_default(),
+									  namespace, i);
+		if (info && (g_base_info_get_type(info) == GI_INFO_TYPE_FUNCTION))
+		{
+			seed_gobject_define_property_from_function_info((GIFunctionInfo *)
+															info, namespace_ref,
+															FALSE);
+		}
+		else if (info
+				 && (g_base_info_get_type(info) == GI_INFO_TYPE_ENUM
+					 || g_base_info_get_type(info) == GI_INFO_TYPE_FLAGS))
+		{
+			gint num_vals = g_enum_info_get_n_values((GIEnumInfo *) info);
+			gint j;
+			JSObjectRef enum_class = JSObjectMake(eng->context,
+												  0, 0);
+			JSValueProtect(eng->context, (JSValueRef) enum_class);
+			seed_object_set_property(namespace_ref,
+									 g_base_info_get_name(info), enum_class);
+
+			for (j = 0; j < num_vals; j++)
+			{
+				GIValueInfo *val =
+					g_enum_info_get_value((GIEnumInfo *) info, j);
+				gint value = g_value_info_get_value(val);
+				gchar *name =
+					g_strdup(g_base_info_get_name((GIBaseInfo *) val));
+				gint name_len = strlen(name);
+				gint j;
+				JSValueRef value_ref;
+
+				value_ref = JSValueMakeNumber(eng->context, value);
+				JSValueProtect(eng->context, (JSValueRef) value_ref);
+
+				for (j = 0; j < name_len; j++)
+				{
+					if (name[j] == '-')
+						name[j] = '_';
+				}
 
-	    struct_ref = JSObjectMake(eng->context, 0, 0);
+				seed_object_set_property(enum_class, name, value_ref);
 
-	    n_methods = g_struct_info_get_n_methods((GIStructInfo *) info);
+				g_free(name);
 
-	    for (i = 0; i < n_methods; i++)
-	    {
-		finfo = g_struct_info_get_method((GIStructInfo *) info, i);
-		seed_gobject_define_property_from_function_info
-		    (finfo, struct_ref, FALSE);
+			}
+		}
+		else if (info && (g_base_info_get_type(info) == GI_INFO_TYPE_OBJECT))
+		{
+			GType type;
+			JSClassRef class_ref;
 
-	    }
+			type =
+				g_registered_type_info_get_g_type((GIRegisteredTypeInfo *)
+												  info);
+
+			if (type != 0)
+			{
+				JSObjectRef constructor_ref;
+				gint i, n_methods;
+				GIFunctionInfo *finfo;
+				GIFunctionInfoFlags flags;
+
+				class_ref = seed_gobject_get_class_for_gtype(type);
+
+				constructor_ref =
+					JSObjectMake(eng->context,
+								 gobject_constructor_class, (gpointer) type);
+
+				seed_object_set_property(constructor_ref,
+										 "type",
+										 seed_value_from_int(type, exception));
+
+				n_methods = g_object_info_get_n_methods((GIObjectInfo *) info);
+				for (i = 0; i < n_methods; i++)
+				{
+					finfo = g_object_info_get_method((GIObjectInfo *) info, i);
+					flags = g_function_info_get_flags(finfo);
+					if (flags & GI_FUNCTION_IS_CONSTRUCTOR)
+					{
+						seed_gobject_define_property_from_function_info
+							(finfo, constructor_ref, FALSE);
+					}
+					else
+					{
+						g_base_info_unref((GIBaseInfo *) finfo);
+					}
+				}
+
+				seed_object_set_property(namespace_ref,
+										 g_base_info_get_name
+										 (info), constructor_ref);
+				JSValueProtect(eng->context, (JSValueRef) constructor_ref);
+			}
+		}
+		else if (info && (g_base_info_get_type(info) == GI_INFO_TYPE_STRUCT))
+		{
+			JSObjectRef struct_ref;
+			gint i, n_methods;
+			GIFunctionInfo *finfo;
 
-	    seed_object_set_property(namespace_ref,
-				    g_base_info_get_name(info), struct_ref);
+			struct_ref = JSObjectMake(eng->context, 0, 0);
 
-	    JSValueProtect(eng->context, (JSValueRef) struct_ref);
-	}
-	else if (info && (g_base_info_get_type(info) == GI_INFO_TYPE_CALLBACK))
-	{
-	    JSObjectRef callback_ref = JSObjectMake(eng->context,
-						    seed_callback_class,
-						    info);
-	    seed_object_set_property(namespace_ref,
-				    g_base_info_get_name(info),
-				    (JSValueRef) callback_ref);
-	}
-	else if (info && (g_base_info_get_type(info) == GI_INFO_TYPE_CONSTANT))
-	{
-	    GArgument argument;
-	    JSValueRef constant_value;
+			n_methods = g_struct_info_get_n_methods((GIStructInfo *) info);
 
-	    g_constant_info_get_value((GIConstantInfo *) info, &argument);
-	    constant_value =
-		seed_gi_argument_make_js(&argument,
-					 g_constant_info_get_type((GIConstantInfo *) info), exception);
-	    seed_object_set_property(namespace_ref,
-				    g_base_info_get_name(info), constant_value);
+			for (i = 0; i < n_methods; i++)
+			{
+				finfo = g_struct_info_get_method((GIStructInfo *) info, i);
+				seed_gobject_define_property_from_function_info
+					(finfo, struct_ref, FALSE);
 
-	}
+			}
+
+			seed_object_set_property(namespace_ref,
+									 g_base_info_get_name(info), struct_ref);
+
+			JSValueProtect(eng->context, (JSValueRef) struct_ref);
+		}
+		else if (info && (g_base_info_get_type(info) == GI_INFO_TYPE_CALLBACK))
+		{
+			JSObjectRef callback_ref = JSObjectMake(eng->context,
+													seed_callback_class,
+													info);
+			seed_object_set_property(namespace_ref,
+									 g_base_info_get_name(info),
+									 (JSValueRef) callback_ref);
+		}
+		else if (info && (g_base_info_get_type(info) == GI_INFO_TYPE_CONSTANT))
+		{
+			GArgument argument;
+			JSValueRef constant_value;
+
+			g_constant_info_get_value((GIConstantInfo *) info, &argument);
+			constant_value =
+				seed_gi_argument_make_js(&argument,
+										 g_constant_info_get_type((GIConstantInfo *) info), exception);
+			seed_object_set_property(namespace_ref,
+									 g_base_info_get_name(info),
+									 constant_value);
+
+		}
 
-    }
+	}
 
-    extension =
-	g_strdup_printf("try{Seed.include(\"/usr/share/seed/%s.js\");}"
-			"catch(e){}"
-			"Seed.include(\"/usr/local/share/seed/%s.js\");",
-			namespace, namespace);
-    extension_script = JSStringCreateWithUTF8CString(extension);
-    JSEvaluateScript(eng->context, extension_script, NULL, NULL, 0, NULL);
-    JSStringRelease(extension_script);
+	extension =
+		g_strdup_printf("try{Seed.include(\"/usr/share/seed/%s.js\");}"
+						"catch(e){}"
+						"Seed.include(\"/usr/local/share/seed/%s.js\");",
+						namespace, namespace);
+	extension_script = JSStringCreateWithUTF8CString(extension);
+	JSEvaluateScript(eng->context, extension_script, NULL, NULL, 0, NULL);
+	JSStringRelease(extension_script);
 
-    g_free((gchar *) namespace);
+	g_free((gchar *) namespace);
 
-    return JSValueMakeNull(eng->context);
+	return JSValueMakeNull(eng->context);
 }
 
 JSStaticFunction gobject_static_funcs[] = {
-    {"equals", seed_gobject_equals, 0},
-    {"__debug_ref_count", seed_gobject_ref_count, 0}
-    ,
-    {0, 0, 0}
+	{"equals", seed_gobject_equals, 0}
+	,
+	{"__debug_ref_count", seed_gobject_ref_count, 0}
+	,
+	{0, 0, 0}
 };
 
 JSClassDefinition gobject_def = {
-    0,				/* Version, always 0 */
-    kJSClassAttributeNoAutomaticPrototype,	/* JSClassAttributes */
-    "gobject",			/* Class Name */
-    NULL,			/* Parent Class */
-    NULL,			/* Static Values */
-    gobject_static_funcs,	/* Static Functions */
-    seed_gobject_initialize,	/* Initialize */
-    seed_gobject_finalize,	/* Finalize */
-    NULL,			/* Has Property */
-    seed_gobject_get_property,	/* Get Property */
-    seed_gobject_set_property,	/* Set Property */
-    NULL,			/* Delete Property */
-    NULL,			/* Get Property Names */
-    NULL,			/* Call As Function */
-    NULL,			/* Call As Constructor */
-    NULL,			/* Has Instance */
-    NULL			/* Convert To Type */
+	0,							/* Version, always 0 */
+	kJSClassAttributeNoAutomaticPrototype,	/* JSClassAttributes */
+	"gobject",					/* Class Name */
+	NULL,						/* Parent Class */
+	NULL,						/* Static Values */
+	gobject_static_funcs,		/* Static Functions */
+	seed_gobject_initialize,	/* Initialize */
+	seed_gobject_finalize,		/* Finalize */
+	NULL,						/* Has Property */
+	seed_gobject_get_property,	/* Get Property */
+	seed_gobject_set_property,	/* Set Property */
+	NULL,						/* Delete Property */
+	NULL,						/* Get Property Names */
+	NULL,						/* Call As Function */
+	NULL,						/* Call As Constructor */
+	NULL,						/* Has Instance */
+	NULL						/* Convert To Type */
 };
 
 JSClassDefinition gobject_method_def = {
-    0,				/* Version, always 0 */
-    0,
-    "gobject_method",		/* Class Name */
-    NULL,			/* Parent Class */
-    NULL,			/* Static Values */
-    NULL,			/* Static Functions */
-    NULL,
-    NULL,			/* Finalize */
-    NULL,			/* Has Property */
-    NULL,			/* Get Property */
-    NULL,			/* Set Property */
-    NULL,			/* Delete Property */
-    NULL,			/* Get Property Names */
-    seed_gobject_method_invoked,	/* Call As Function */
-    NULL,			/* Call As Constructor */
-    NULL,			/* Has Instance */
-    NULL			/* Convert To Type */
+	0,							/* Version, always 0 */
+	0,
+	"gobject_method",			/* Class Name */
+	NULL,						/* Parent Class */
+	NULL,						/* Static Values */
+	NULL,						/* Static Functions */
+	NULL,
+	NULL,						/* Finalize */
+	NULL,						/* Has Property */
+	NULL,						/* Get Property */
+	NULL,						/* Set Property */
+	NULL,						/* Delete Property */
+	NULL,						/* Get Property Names */
+	seed_gobject_method_invoked,	/* Call As Function */
+	NULL,						/* Call As Constructor */
+	NULL,						/* Has Instance */
+	NULL						/* Convert To Type */
 };
 
 JSClassDefinition seed_callback_def = {
-    0,				/* Version, always 0 */
-    0,
-    "seed_callback",		/* Class Name */
-    NULL,			/* Parent Class */
-    NULL,			/* Static Values */
-    NULL,			/* Static Functions */
-    NULL,
-    NULL,			/* Finalize */
-    NULL,			/* Has Property */
-    NULL,			/* Get Property */
-    NULL,			/* Set Property */
-    NULL,			/* Delete Property */
-    NULL,			/* Get Property Names */
-    NULL,			/* Call As Function */
-    NULL,			/* Call As Constructor */
-    NULL,			/* Has Instance */
-    NULL			/* Convert To Type */
+	0,							/* Version, always 0 */
+	0,
+	"seed_callback",			/* Class Name */
+	NULL,						/* Parent Class */
+	NULL,						/* Static Values */
+	NULL,						/* Static Functions */
+	NULL,
+	NULL,						/* Finalize */
+	NULL,						/* Has Property */
+	NULL,						/* Get Property */
+	NULL,						/* Set Property */
+	NULL,						/* Delete Property */
+	NULL,						/* Get Property Names */
+	NULL,						/* Call As Function */
+	NULL,						/* Call As Constructor */
+	NULL,						/* Has Instance */
+	NULL						/* Convert To Type */
 };
 
 JSClassDefinition gobject_constructor_def = {
-    0,				/* Version, always 0 */
-    0,
-    "gobject_constructor",	/* Class Name */
-    NULL,			/* Parent Class */
-    NULL,			/* Static Values */
-    NULL,			/* Static Functions */
-    NULL,
-    NULL,			/* Finalize */
-    NULL,			/* Has Property */
-    NULL,			/* Get Property */
-    NULL,			/* Set Property */
-    NULL,			/* Delete Property */
-    NULL,			/* Get Property Names */
-    NULL,			/* Call As Function */
-    seed_gobject_constructor_invoked,	/* Call As Constructor */
-    NULL,			/* Has Instance */
-    NULL			/* Convert To Type */
+	0,							/* Version, always 0 */
+	0,
+	"gobject_constructor",		/* Class Name */
+	NULL,						/* Parent Class */
+	NULL,						/* Static Values */
+	NULL,						/* Static Functions */
+	NULL,
+	NULL,						/* Finalize */
+	NULL,						/* Has Property */
+	NULL,						/* Get Property */
+	NULL,						/* Set Property */
+	NULL,						/* Delete Property */
+	NULL,						/* Get Property Names */
+	NULL,						/* Call As Function */
+	seed_gobject_constructor_invoked,	/* Call As Constructor */
+	NULL,						/* Has Instance */
+	NULL						/* Convert To Type */
 };
 
 void seed_create_function(gchar * name, gpointer func, JSObjectRef obj)
 {
-    JSObjectRef oref;
+	JSObjectRef oref;
 
-    oref = JSObjectMakeFunctionWithCallback(eng->context, NULL, func);
-    JSValueProtect(eng->context, oref);
-    seed_object_set_property(obj, name, oref);
+	oref = JSObjectMakeFunctionWithCallback(eng->context, NULL, func);
+	JSValueProtect(eng->context, oref);
+	seed_object_set_property(obj, name, oref);
 }
 
 static void
 seed_log_handler(const gchar * domain,
-		 GLogLevelFlags log_level,
-		 const gchar * message, gpointer user_data)
+				 GLogLevelFlags log_level,
+				 const gchar * message, gpointer user_data)
 {
-    glib_message = g_strdup(message);
+	glib_message = g_strdup(message);
 }
 
 #ifdef SEED_ENABLE_DEBUG
 static gboolean
-seed_arg_debug_cb (const char *key,
-                   const char *value,
-                   gpointer    user_data)
-{
-    seed_debug_flags |=
-        g_parse_debug_string (value,
-                              seed_debug_keys,
-                              G_N_ELEMENTS (seed_debug_keys));
-    return TRUE;
+seed_arg_debug_cb(const char *key, const char *value, gpointer user_data)
+{
+	seed_debug_flags |=
+		g_parse_debug_string(value,
+							 seed_debug_keys, G_N_ELEMENTS(seed_debug_keys));
+	return TRUE;
 }
 
 static gboolean
-seed_arg_no_debug_cb (const char *key,
-                      const char *value,
-                      gpointer    user_data)
-{
-    seed_debug_flags &=
-        ~g_parse_debug_string (value,
-                               seed_debug_keys,
-                               G_N_ELEMENTS (seed_debug_keys));
-    return TRUE;
+seed_arg_no_debug_cb(const char *key, const char *value, gpointer user_data)
+{
+	seed_debug_flags &=
+		~g_parse_debug_string(value,
+							  seed_debug_keys, G_N_ELEMENTS(seed_debug_keys));
+	return TRUE;
 }
-#endif /* SEED_ENABLE_DEBUG */
+#endif							/* SEED_ENABLE_DEBUG */
 
 static GOptionEntry seed_args[] = {
 #ifdef SEED_ENABLE_DEBUG
-  { "seed-debug", 0, 0, G_OPTION_ARG_CALLBACK, seed_arg_debug_cb,
-    "Seed debugging flags to set", "FLAGS" },
-  { "seed-no-debug", 0, 0, G_OPTION_ARG_CALLBACK, seed_arg_no_debug_cb,
-    "Seed debugging flags to unset", "FLAGS" },
-#endif /* SEED_ENABLE_DEBUG */
-  { NULL, },
+	{"seed-debug", 0, 0, G_OPTION_ARG_CALLBACK, seed_arg_debug_cb,
+	 "Seed debugging flags to set", "FLAGS"},
+	{"seed-no-debug", 0, 0, G_OPTION_ARG_CALLBACK, seed_arg_no_debug_cb,
+	 "Seed debugging flags to unset", "FLAGS"},
+#endif							/* SEED_ENABLE_DEBUG */
+	{NULL,},
 };
 
-GOptionGroup * seed_get_option_group (void)
+GOptionGroup *seed_get_option_group(void)
 {
-    GOptionGroup *group;
+	GOptionGroup *group;
 
-    group = g_option_group_new ("seed",
-                              "Seed Options",
-                              "Show Seed Options",
-                              NULL,
-                              NULL);
+	group = g_option_group_new("seed",
+							   "Seed Options", "Show Seed Options", NULL, NULL);
 
-    g_option_group_add_entries (group, seed_args);
+	g_option_group_add_entries(group, seed_args);
 
-    return group;
+	return group;
 }
 
-static gboolean seed_parse_args(int * argc, char *** argv)
+static gboolean seed_parse_args(int *argc, char ***argv)
 {
-    GOptionContext *option_context;
-    GOptionGroup   *seed_group;
-    GError         *error = NULL;
-    gboolean        ret = TRUE;
+	GOptionContext *option_context;
+	GOptionGroup *seed_group;
+	GError *error = NULL;
+	gboolean ret = TRUE;
 
-    option_context = g_option_context_new (NULL);
-    g_option_context_set_ignore_unknown_options (option_context, TRUE);
-    g_option_context_set_help_enabled (option_context, FALSE);
+	option_context = g_option_context_new(NULL);
+	g_option_context_set_ignore_unknown_options(option_context, TRUE);
+	g_option_context_set_help_enabled(option_context, FALSE);
 
-    /* Initiate any command line options from the backend */
+	/* Initiate any command line options from the backend */
 
-    seed_group = seed_get_option_group ();
-    g_option_context_set_main_group (option_context, seed_group);
+	seed_group = seed_get_option_group();
+	g_option_context_set_main_group(option_context, seed_group);
 
-    if (!g_option_context_parse (option_context, argc, argv, &error))
-    {
-        if (error)
-        {
-            g_warning ("%s", error->message);
-            g_error_free (error);
-        }
+	if (!g_option_context_parse(option_context, argc, argv, &error))
+	{
+		if (error)
+		{
+			g_warning("%s", error->message);
+			g_error_free(error);
+		}
 
-        ret = FALSE;
-    }
+		ret = FALSE;
+	}
 
-    g_option_context_free (option_context);
+	g_option_context_free(option_context);
 
-    return ret;
+	return ret;
 }
 
 gboolean seed_init(gint * argc, gchar *** argv)
 {
-    JSObjectRef seed_obj_ref;
-    JSStringRef defaults_script;
+	JSObjectRef seed_obj_ref;
+	JSStringRef defaults_script;
 
-    g_type_init();
-    g_log_set_handler("GLib-GObject", G_LOG_LEVEL_WARNING, seed_log_handler, 0);
+	g_type_init();
+	g_log_set_handler("GLib-GObject", G_LOG_LEVEL_WARNING, seed_log_handler, 0);
 
-    if (seed_parse_args (argc, argv) == FALSE)
-    {
-        SEED_NOTE(MISC, "failed to parse arguments.");
-        return false;
-    }
-
-    qname = g_quark_from_static_string("js-type");
-    qprototype = g_quark_from_static_string("js-prototype");
-
-    eng = (SeedEngine *) g_malloc(sizeof(SeedEngine));
-
-    eng->context = JSGlobalContextCreateInGroup(NULL, NULL);
-    eng->global = JSContextGetGlobalObject(eng->context);
-    gobject_class = JSClassCreate(&gobject_def);
-    JSClassRetain(gobject_class);
-    gobject_method_class = JSClassCreate(&gobject_method_def);
-    JSClassRetain(gobject_method_class);
-    gobject_constructor_class = JSClassCreate(&gobject_constructor_def);
-    JSClassRetain(gobject_constructor_class);
-    gobject_signal_class = JSClassCreate(seed_get_signal_class());
-    JSClassRetain(gobject_signal_class);
-    seed_callback_class = JSClassCreate(&seed_callback_def);
-    JSClassRetain(seed_callback_class);
-
-    g_type_set_qdata(G_TYPE_OBJECT, qname, gobject_class);
-
-    seed_obj_ref = JSObjectMake(eng->context, NULL, NULL);
-    seed_object_set_property(eng->global, "Seed", seed_obj_ref);
-    JSValueProtect(eng->context, seed_obj_ref);
-
-    seed_create_function("import_namespace", &seed_gi_import_namespace,
-			 seed_obj_ref);
-    seed_init_builtins(argc, argv);
-    seed_closures_init();
-    seed_structs_init();
-
-    seed_gtype_init();
-
-    defaults_script =
-	JSStringCreateWithUTF8CString("try{Seed.include(\"/usr/share/"
-				      "seed/Seed.js\");} catch(e){}"
-				      "Seed.include(\"/usr/local/share"
-				      "/seed/Seed.js\");");
-    JSEvaluateScript(eng->context, defaults_script, NULL, NULL, 0, NULL);
-    JSStringRelease(defaults_script);
+	if (seed_parse_args(argc, argv) == FALSE)
+	{
+		SEED_NOTE(MISC, "failed to parse arguments.");
+		return false;
+	}
+
+	qname = g_quark_from_static_string("js-type");
+	qprototype = g_quark_from_static_string("js-prototype");
+
+	eng = (SeedEngine *) g_malloc(sizeof(SeedEngine));
+
+	eng->context = JSGlobalContextCreateInGroup(NULL, NULL);
+	eng->global = JSContextGetGlobalObject(eng->context);
+	gobject_class = JSClassCreate(&gobject_def);
+	JSClassRetain(gobject_class);
+	gobject_method_class = JSClassCreate(&gobject_method_def);
+	JSClassRetain(gobject_method_class);
+	gobject_constructor_class = JSClassCreate(&gobject_constructor_def);
+	JSClassRetain(gobject_constructor_class);
+	gobject_signal_class = JSClassCreate(seed_get_signal_class());
+	JSClassRetain(gobject_signal_class);
+	seed_callback_class = JSClassCreate(&seed_callback_def);
+	JSClassRetain(seed_callback_class);
+
+	g_type_set_qdata(G_TYPE_OBJECT, qname, gobject_class);
+
+	seed_obj_ref = JSObjectMake(eng->context, NULL, NULL);
+	seed_object_set_property(eng->global, "Seed", seed_obj_ref);
+	JSValueProtect(eng->context, seed_obj_ref);
+
+	seed_create_function("import_namespace", &seed_gi_import_namespace,
+						 seed_obj_ref);
+	seed_init_builtins(argc, argv);
+	seed_closures_init();
+	seed_structs_init();
+
+	seed_gtype_init();
+
+	defaults_script =
+		JSStringCreateWithUTF8CString("try{Seed.include(\"/usr/share/"
+									  "seed/Seed.js\");} catch(e){}"
+									  "Seed.include(\"/usr/local/share"
+									  "/seed/Seed.js\");");
+	JSEvaluateScript(eng->context, defaults_script, NULL, NULL, 0, NULL);
+	JSStringRelease(defaults_script);
 
-    return TRUE;
+	return TRUE;
 }
 
 SeedScript *seed_make_script(const gchar * js, const gchar * source_url,
-			     gint line_number)
+							 gint line_number)
 {
-    SeedScript *ret = g_new0(SeedScript, 1);
+	SeedScript *ret = g_new0(SeedScript, 1);
 
-    ret->script = JSStringCreateWithUTF8CString(js);
+	ret->script = JSStringCreateWithUTF8CString(js);
 
-    if (source_url)
-    {
-	    ret->source_url = JSStringCreateWithUTF8CString(source_url);
-    }
-    ret->line_number = line_number;
+	if (source_url)
+	{
+		ret->source_url = JSStringCreateWithUTF8CString(source_url);
+	}
+	ret->line_number = line_number;
 
-    JSCheckScriptSyntax(eng->context, ret->script,
-			ret->source_url, ret->line_number, &ret->exception);
+	JSCheckScriptSyntax(eng->context, ret->script,
+						ret->source_url, ret->line_number, &ret->exception);
 
-    return ret;
+	return ret;
 }
 
 JSValueRef seed_evaluate(SeedScript * js, JSObjectRef this)
 {
-    JSValueRef ret;
+	JSValueRef ret;
 
-    js->exception = 0;
-    ret = JSEvaluateScript(eng->context,
-			   js->script, this, js->source_url,
-			   js->line_number, &js->exception);
+	js->exception = 0;
+	ret = JSEvaluateScript(eng->context,
+						   js->script, this, js->source_url,
+						   js->line_number, &js->exception);
 
-    return ret;
+	return ret;
 }
 
 JSValueRef seed_script_exception(SeedScript * s)
 {
-    return s->exception;
+	return s->exception;
 }

Modified: trunk/libseed/seed-engine.h
==============================================================================
--- trunk/libseed/seed-engine.h	(original)
+++ trunk/libseed/seed-engine.h	Sat Nov 22 19:00:31 2008
@@ -31,11 +31,11 @@
 extern SeedEngine *eng;
 
 typedef struct _SeedScript {
-    JSStringRef script;
-    JSValueRef exception;
+	JSStringRef script;
+	JSValueRef exception;
 
-    JSStringRef source_url;
-    gint line_number;
+	JSStringRef source_url;
+	gint line_number;
 } SeedScript;
 
 JSObjectRef seed_gobject_get_prototype_for_gtype(GType type);
@@ -43,8 +43,8 @@
 
 void
 seed_gobject_define_property_from_function_info(GIFunctionInfo * info,
-						JSObjectRef object,
-						gboolean instance);
+												JSObjectRef object,
+												gboolean instance);
 void seed_create_function(gchar * name, gpointer func, JSObjectRef obj);
 
 #endif

Modified: trunk/libseed/seed-exceptions.c
==============================================================================
--- trunk/libseed/seed-exceptions.c	(original)
+++ trunk/libseed/seed-exceptions.c	Sat Nov 22 19:00:31 2008
@@ -23,117 +23,117 @@
 
 void
 seed_make_exception(JSValueRef * exception,
-		    const gchar * name, const gchar * message)
+					const gchar * name, const gchar * message)
 {
-    JSStringRef js_name = 0;
-    JSStringRef js_message = 0;
-    JSValueRef js_name_ref = 0, js_message_ref = 0;
-    JSObjectRef exception_obj;
-
-    if (!exception)
-	return;
-
-    if (name)
-    {
-	js_name = JSStringCreateWithUTF8CString(name);
-	js_name_ref = JSValueMakeString(eng->context, js_name);
-    }
-    if (message)
-    {
-	js_message = JSStringCreateWithUTF8CString(message);
-	js_message_ref = JSValueMakeString(eng->context, js_message);
-    }
-
-    exception_obj = JSObjectMake(eng->context, 0, NULL);
-    seed_object_set_property(exception_obj, "message", js_message_ref);
-    seed_object_set_property(exception_obj, "name", js_name_ref);
+	JSStringRef js_name = 0;
+	JSStringRef js_message = 0;
+	JSValueRef js_name_ref = 0, js_message_ref = 0;
+	JSObjectRef exception_obj;
 
-    *exception = exception_obj;
+	if (!exception)
+		return;
 
-    JSStringRelease(js_name);
-    JSStringRelease(js_message);
+	if (name)
+	{
+		js_name = JSStringCreateWithUTF8CString(name);
+		js_name_ref = JSValueMakeString(eng->context, js_name);
+	}
+	if (message)
+	{
+		js_message = JSStringCreateWithUTF8CString(message);
+		js_message_ref = JSValueMakeString(eng->context, js_message);
+	}
+
+	exception_obj = JSObjectMake(eng->context, 0, NULL);
+	seed_object_set_property(exception_obj, "message", js_message_ref);
+	seed_object_set_property(exception_obj, "name", js_name_ref);
+
+	*exception = exception_obj;
+
+	JSStringRelease(js_name);
+	JSStringRelease(js_message);
 }
 
 void seed_make_exception_from_gerror(JSValueRef * exception, GError * error)
 {
-    const gchar *domain = g_quark_to_string(error->domain);
-    GString *string = g_string_new(domain);
-    int i;
-
-    *(string->str) = g_unichar_toupper(*(string->str));
-    for (i = 0; i < string->len; i++)
-    {
-	if (*(string->str + i) == '-')
+	const gchar *domain = g_quark_to_string(error->domain);
+	GString *string = g_string_new(domain);
+	int i;
+
+	*(string->str) = g_unichar_toupper(*(string->str));
+	for (i = 0; i < string->len; i++)
 	{
-	    *(string->str + i + 1) = g_unichar_toupper(*(string->str + i + 1));
-	    g_string_erase(string, i, 1);
-	}
-	else if (!strcmp(string->str + i - 1, "Quark"))
-	    g_string_truncate(string, i - 1);
+		if (*(string->str + i) == '-')
+		{
+			*(string->str + i + 1) = g_unichar_toupper(*(string->str + i + 1));
+			g_string_erase(string, i, 1);
+		}
+		else if (!strcmp(string->str + i - 1, "Quark"))
+			g_string_truncate(string, i - 1);
 
-    }
-    seed_make_exception(exception, string->str, error->message);
+	}
+	seed_make_exception(exception, string->str, error->message);
 
-    g_string_free(string, TRUE);
+	g_string_free(string, TRUE);
 }
 
 gchar *seed_exception_get_name(JSValueRef e)
 {
-    JSValueRef name;
-    g_assert((e));
-    if (!JSValueIsObject(eng->context, e))
-	return 0;
+	JSValueRef name;
+	g_assert((e));
+	if (!JSValueIsObject(eng->context, e))
+		return 0;
 
-    name = seed_object_get_property((JSObjectRef)e, "name");
-    return seed_value_to_string(name, 0);
+	name = seed_object_get_property((JSObjectRef) e, "name");
+	return seed_value_to_string(name, 0);
 }
 
 gchar *seed_exception_get_message(JSValueRef e)
 {
-    JSValueRef name;
-    g_assert((e));
-    if (!JSValueIsObject(eng->context, e))
-	return 0;
+	JSValueRef name;
+	g_assert((e));
+	if (!JSValueIsObject(eng->context, e))
+		return 0;
 
-    name = seed_object_get_property((JSObjectRef)e, "message");
-    return seed_value_to_string(name, 0);
+	name = seed_object_get_property((JSObjectRef) e, "message");
+	return seed_value_to_string(name, 0);
 }
 
 guint seed_exception_get_line(JSValueRef e)
 {
-    JSValueRef line;
-    g_assert((e));
-    if (!JSValueIsObject(eng->context, e))
-	return 0;
-    line = seed_object_get_property((JSObjectRef)e, "line");
-    return seed_value_to_uint(line, 0);
+	JSValueRef line;
+	g_assert((e));
+	if (!JSValueIsObject(eng->context, e))
+		return 0;
+	line = seed_object_get_property((JSObjectRef) e, "line");
+	return seed_value_to_uint(line, 0);
 }
 
 gchar *seed_exception_get_file(JSValueRef e)
 {
-    JSValueRef line;
-    g_assert((e));
-    if (!JSValueIsObject(eng->context, e))
-	return 0;
-    line = seed_object_get_property((JSObjectRef)e, "sourceURL");
-    return seed_value_to_string(line, 0);
+	JSValueRef line;
+	g_assert((e));
+	if (!JSValueIsObject(eng->context, e))
+		return 0;
+	line = seed_object_get_property((JSObjectRef) e, "sourceURL");
+	return seed_value_to_string(line, 0);
 }
 
 gchar *seed_exception_to_string(JSValueRef e)
 {
-    guint line;
-    gchar *mes, *name, *file, *ret;
+	guint line;
+	gchar *mes, *name, *file, *ret;
 
-    line = seed_exception_get_line(e);
-    mes = seed_exception_get_message(e);
-    file = seed_exception_get_file(e);
-    name = seed_exception_get_name(e);
+	line = seed_exception_get_line(e);
+	mes = seed_exception_get_message(e);
+	file = seed_exception_get_file(e);
+	name = seed_exception_get_name(e);
 
-    ret = g_strdup_printf("Line %d in %s: %s %s", line, file, name, mes);
+	ret = g_strdup_printf("Line %d in %s: %s %s", line, file, name, mes);
 
-    g_free(mes);
-    g_free(file);
-    g_free(name);
+	g_free(mes);
+	g_free(file);
+	g_free(name);
 
-    return ret;
+	return ret;
 }

Modified: trunk/libseed/seed-exceptions.h
==============================================================================
--- trunk/libseed/seed-exceptions.h	(original)
+++ trunk/libseed/seed-exceptions.h	Sat Nov 22 19:00:31 2008
@@ -24,7 +24,7 @@
 #include "seed-private.h"
 
 void seed_make_exception(JSValueRef * exception,
-			 const gchar * name, const gchar * message);
+						 const gchar * name, const gchar * message);
 
 void seed_make_exception_from_gerror(JSValueRef * exception, GError * e);
 

Modified: trunk/libseed/seed-gtype.c
==============================================================================
--- trunk/libseed/seed-gtype.c	(original)
+++ trunk/libseed/seed-gtype.c	Sat Nov 22 19:00:31 2008
@@ -25,613 +25,600 @@
 JSClassRef seed_gtype_class;
 
 /* From pygobject */
-static ffi_type *
-g_value_to_ffi_type (const GValue *gvalue, gpointer *value)
+static ffi_type *g_value_to_ffi_type(const GValue * gvalue, gpointer * value)
 {
-    ffi_type *rettype = NULL;
-    GType type = g_type_fundamental (G_VALUE_TYPE (gvalue));
-    g_assert (type != G_TYPE_INVALID);
-
-    switch (type) {
-    case G_TYPE_BOOLEAN:
-    case G_TYPE_CHAR:
-    case G_TYPE_INT:
-	rettype = &ffi_type_sint;
-	*value = (gpointer)&(gvalue->data[0].v_int);
-	break;
-    case G_TYPE_UCHAR:
-    case G_TYPE_UINT:
-	rettype = &ffi_type_uint;
-	*value = (gpointer)&(gvalue->data[0].v_uint);
-	break;
-    case G_TYPE_STRING:
-    case G_TYPE_OBJECT:
-    case G_TYPE_BOXED:
-    case G_TYPE_POINTER:
-	rettype = &ffi_type_pointer;
-	*value = (gpointer)&(gvalue->data[0].v_pointer);
-	break;
-    case G_TYPE_FLOAT:
-	rettype = &ffi_type_float;
-	*value = (gpointer)&(gvalue->data[0].v_float);
-	break;
-    case G_TYPE_DOUBLE:
-	rettype = &ffi_type_double;
-	*value = (gpointer)&(gvalue->data[0].v_double);
-	break;
-    case G_TYPE_LONG:
-	rettype = &ffi_type_slong;
-	*value = (gpointer)&(gvalue->data[0].v_long);
-	break;
-    case G_TYPE_ULONG:
-	rettype = &ffi_type_ulong;
-	*value = (gpointer)&(gvalue->data[0].v_ulong);
-	break;
-    case G_TYPE_INT64:
-	rettype = &ffi_type_sint64;
-	*value = (gpointer)&(gvalue->data[0].v_int64);
-	break;
-    case G_TYPE_UINT64:
-	rettype = &ffi_type_uint64;
-	*value = (gpointer)&(gvalue->data[0].v_uint64);
-	break;
-    default:
-	rettype = &ffi_type_pointer;
-	*value = NULL;
-	g_warning ("Unsupported fundamental type: %s", g_type_name (type));
-	break;
-    }
-    return rettype;
+	ffi_type *rettype = NULL;
+	GType type = g_type_fundamental(G_VALUE_TYPE(gvalue));
+	g_assert(type != G_TYPE_INVALID);
+
+	switch (type)
+	{
+	case G_TYPE_BOOLEAN:
+	case G_TYPE_CHAR:
+	case G_TYPE_INT:
+		rettype = &ffi_type_sint;
+		*value = (gpointer) & (gvalue->data[0].v_int);
+		break;
+	case G_TYPE_UCHAR:
+	case G_TYPE_UINT:
+		rettype = &ffi_type_uint;
+		*value = (gpointer) & (gvalue->data[0].v_uint);
+		break;
+	case G_TYPE_STRING:
+	case G_TYPE_OBJECT:
+	case G_TYPE_BOXED:
+	case G_TYPE_POINTER:
+		rettype = &ffi_type_pointer;
+		*value = (gpointer) & (gvalue->data[0].v_pointer);
+		break;
+	case G_TYPE_FLOAT:
+		rettype = &ffi_type_float;
+		*value = (gpointer) & (gvalue->data[0].v_float);
+		break;
+	case G_TYPE_DOUBLE:
+		rettype = &ffi_type_double;
+		*value = (gpointer) & (gvalue->data[0].v_double);
+		break;
+	case G_TYPE_LONG:
+		rettype = &ffi_type_slong;
+		*value = (gpointer) & (gvalue->data[0].v_long);
+		break;
+	case G_TYPE_ULONG:
+		rettype = &ffi_type_ulong;
+		*value = (gpointer) & (gvalue->data[0].v_ulong);
+		break;
+	case G_TYPE_INT64:
+		rettype = &ffi_type_sint64;
+		*value = (gpointer) & (gvalue->data[0].v_int64);
+		break;
+	case G_TYPE_UINT64:
+		rettype = &ffi_type_uint64;
+		*value = (gpointer) & (gvalue->data[0].v_uint64);
+		break;
+	default:
+		rettype = &ffi_type_pointer;
+		*value = NULL;
+		g_warning("Unsupported fundamental type: %s", g_type_name(type));
+		break;
+	}
+	return rettype;
 }
 
 /* From pygobject */
-static void
-g_value_from_ffi_type (GValue *gvalue, gpointer *value)
+static void g_value_from_ffi_type(GValue * gvalue, gpointer * value)
 {
-    switch (g_type_fundamental (G_VALUE_TYPE (gvalue))) {
-    case G_TYPE_INT:
-	g_value_set_int (gvalue, *(gint*)value);
-	break;
-    case G_TYPE_FLOAT:
-	g_value_set_float (gvalue, *(gfloat*)value);
-	break;
-    case G_TYPE_DOUBLE:
-	g_value_set_double (gvalue, *(gdouble*)value);
-	break;
-    case G_TYPE_BOOLEAN:
-	g_value_set_boolean (gvalue, *(gboolean*)value);
-	break;
-    case G_TYPE_STRING:
-	g_value_set_string (gvalue, *(gchar**)value);
-	break;
-    case G_TYPE_CHAR:
-	g_value_set_char (gvalue, *(gchar*)value);
-	break;
-    case G_TYPE_UCHAR:
-	g_value_set_uchar (gvalue, *(guchar*)value);
-	break;
-    case G_TYPE_UINT:
-	g_value_set_uint (gvalue, *(guint*)value);
-	break;
-    case G_TYPE_POINTER:
-	g_value_set_pointer (gvalue, *(gpointer*)value);
-	break;
-    case G_TYPE_LONG:
-	g_value_set_long (gvalue, *(glong*)value);
-	break;
-    case G_TYPE_ULONG:
-	g_value_set_ulong (gvalue, *(gulong*)value);
-	break;
-    case G_TYPE_INT64:
-	g_value_set_int64 (gvalue, *(gint64*)value);
-	break;
-    case G_TYPE_UINT64:
-	g_value_set_uint64 (gvalue, *(guint64*)value);
-	break;
-    case G_TYPE_BOXED:
-	g_value_set_boxed (gvalue, *(gpointer*)value);
-	break;
-    default:
-	g_warning ("Unsupported fundamental type: %s",
-		   g_type_name (g_type_fundamental (G_VALUE_TYPE (gvalue))));
-    }
+	switch (g_type_fundamental(G_VALUE_TYPE(gvalue)))
+	{
+	case G_TYPE_INT:
+		g_value_set_int(gvalue, *(gint *) value);
+		break;
+	case G_TYPE_FLOAT:
+		g_value_set_float(gvalue, *(gfloat *) value);
+		break;
+	case G_TYPE_DOUBLE:
+		g_value_set_double(gvalue, *(gdouble *) value);
+		break;
+	case G_TYPE_BOOLEAN:
+		g_value_set_boolean(gvalue, *(gboolean *) value);
+		break;
+	case G_TYPE_STRING:
+		g_value_set_string(gvalue, *(gchar **) value);
+		break;
+	case G_TYPE_CHAR:
+		g_value_set_char(gvalue, *(gchar *) value);
+		break;
+	case G_TYPE_UCHAR:
+		g_value_set_uchar(gvalue, *(guchar *) value);
+		break;
+	case G_TYPE_UINT:
+		g_value_set_uint(gvalue, *(guint *) value);
+		break;
+	case G_TYPE_POINTER:
+		g_value_set_pointer(gvalue, *(gpointer *) value);
+		break;
+	case G_TYPE_LONG:
+		g_value_set_long(gvalue, *(glong *) value);
+		break;
+	case G_TYPE_ULONG:
+		g_value_set_ulong(gvalue, *(gulong *) value);
+		break;
+	case G_TYPE_INT64:
+		g_value_set_int64(gvalue, *(gint64 *) value);
+		break;
+	case G_TYPE_UINT64:
+		g_value_set_uint64(gvalue, *(guint64 *) value);
+		break;
+	case G_TYPE_BOXED:
+		g_value_set_boxed(gvalue, *(gpointer *) value);
+		break;
+	default:
+		g_warning("Unsupported fundamental type: %s",
+				  g_type_name(g_type_fundamental(G_VALUE_TYPE(gvalue))));
+	}
 
 }
 
 /* from pygobject */
 void
-g_cclosure_marshal_generic_ffi (GClosure *closure,
-				GValue *return_gvalue,
-				guint n_param_values,
-				const GValue *param_values,
-				gpointer invocation_hint,
-				gpointer marshal_data)
-{
-    ffi_type *rtype;
-    void *rvalue;
-    int n_args;
-    ffi_type **atypes;
-    void **args;
-    int i;
-    ffi_cif cif;
-    GCClosure *cc = (GCClosure*) closure;
-
-    if (return_gvalue && G_VALUE_TYPE (return_gvalue)) 
-    {
-	rtype = g_value_to_ffi_type (return_gvalue, &rvalue);
-    }
-    else 
-    {
-	rtype = &ffi_type_void;
-    }
-
-    rvalue = g_alloca (MAX (rtype->size, sizeof (ffi_arg)));
-  
-    n_args = n_param_values + 1;
-    atypes = g_alloca (sizeof (ffi_type *) * n_args);
-    args =  g_alloca (sizeof (gpointer) * n_args);
-
-    if (G_CCLOSURE_SWAP_DATA (closure))
-    {
-	atypes[n_args-1] = g_value_to_ffi_type (param_values + 0,  
-						&args[n_args-1]);
-	atypes[0] = &ffi_type_pointer;
-	args[0] = &closure->data;
-    }
-    else
-    {
-	atypes[0] = g_value_to_ffi_type (param_values + 0, &args[0]);
-	atypes[n_args-1] = &ffi_type_pointer;
-	args[n_args-1] = &closure->data;
-    }
-
-    for (i = 1; i < n_args - 1; i++)
-	atypes[i] = g_value_to_ffi_type (param_values + i, &args[i]);
+g_cclosure_marshal_generic_ffi(GClosure * closure,
+							   GValue * return_gvalue,
+							   guint n_param_values,
+							   const GValue * param_values,
+							   gpointer invocation_hint, gpointer marshal_data)
+{
+	ffi_type *rtype;
+	void *rvalue;
+	int n_args;
+	ffi_type **atypes;
+	void **args;
+	int i;
+	ffi_cif cif;
+	GCClosure *cc = (GCClosure *) closure;
+
+	if (return_gvalue && G_VALUE_TYPE(return_gvalue))
+	{
+		rtype = g_value_to_ffi_type(return_gvalue, &rvalue);
+	}
+	else
+	{
+		rtype = &ffi_type_void;
+	}
+
+	rvalue = g_alloca(MAX(rtype->size, sizeof(ffi_arg)));
+
+	n_args = n_param_values + 1;
+	atypes = g_alloca(sizeof(ffi_type *) * n_args);
+	args = g_alloca(sizeof(gpointer) * n_args);
+
+	if (G_CCLOSURE_SWAP_DATA(closure))
+	{
+		atypes[n_args - 1] = g_value_to_ffi_type(param_values + 0,
+												 &args[n_args - 1]);
+		atypes[0] = &ffi_type_pointer;
+		args[0] = &closure->data;
+	}
+	else
+	{
+		atypes[0] = g_value_to_ffi_type(param_values + 0, &args[0]);
+		atypes[n_args - 1] = &ffi_type_pointer;
+		args[n_args - 1] = &closure->data;
+	}
 
-    if (ffi_prep_cif (&cif, FFI_DEFAULT_ABI, n_args, rtype, atypes) != FFI_OK)
-	return;
+	for (i = 1; i < n_args - 1; i++)
+		atypes[i] = g_value_to_ffi_type(param_values + i, &args[i]);
 
-    ffi_call (&cif, marshal_data ? marshal_data : cc->callback, rvalue, args);
+	if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, n_args, rtype, atypes) != FFI_OK)
+		return;
 
-    if (return_gvalue && G_VALUE_TYPE (return_gvalue))
-	g_value_from_ffi_type (return_gvalue, rvalue);
+	ffi_call(&cif, marshal_data ? marshal_data : cc->callback, rvalue, args);
+
+	if (return_gvalue && G_VALUE_TYPE(return_gvalue))
+		g_value_from_ffi_type(return_gvalue, rvalue);
 }
 
 static JSValueRef
 seed_property_method_invoked(JSContextRef ctx,
-			    JSObjectRef function,
-			    JSObjectRef thisObject,
-			    size_t argumentCount,
-			    const JSValueRef arguments[],
-			    JSValueRef * exception)
-{
-    GParamSpec * spec;
-    GObjectClass * class;
-    int property_count;
-    JSValueRef newcount, oldcount;
-
-    if (argumentCount != 1)
-    {
-	gchar * mes = g_strdup_printf("Property installation expected 1 argument",
-				      " got %d \n", argumentCount);
-	seed_make_exception(exception, "ArgumentError", mes);
-	g_free(mes);
-	
-	return JSValueMakeNull(eng->context);
-    }
-    
-    if (JSValueIsNull(eng->context, arguments[0]) || 
-	// Might need to check if JSValueIsObject? Who knows with WebKit.
-	!JSValueIsObjectOfClass(eng->context, arguments[0], seed_struct_class))
-    {
-	seed_make_exception(exception, "ArgumentError", "Property installation expected a "
-			    "GParamSpec as argument");
-	return JSValueMakeNull(eng->context);
-    }
-    
-    spec = (GParamSpec *)seed_pointer_get_pointer(arguments[0]);
-    
-    oldcount = seed_object_get_property(thisObject, "property_count");
-    property_count = seed_value_to_int(oldcount, exception);
-    
-
-    class = seed_pointer_get_pointer(thisObject);
-    g_object_class_install_property(class, property_count, spec);
-    
-    newcount = seed_value_from_int(property_count+1, exception);
-    seed_object_set_property(thisObject, 
-			     "property_count",
-			     newcount);
-    
-    return oldcount;
+							 JSObjectRef function,
+							 JSObjectRef thisObject,
+							 size_t argumentCount,
+							 const JSValueRef arguments[],
+							 JSValueRef * exception)
+{
+	GParamSpec *spec;
+	GObjectClass *class;
+	int property_count;
+	JSValueRef newcount, oldcount;
+
+	if (argumentCount != 1)
+	{
+		gchar *mes =
+			g_strdup_printf("Property installation expected 1 argument",
+							" got %d \n", argumentCount);
+		seed_make_exception(exception, "ArgumentError", mes);
+		g_free(mes);
+
+		return JSValueMakeNull(eng->context);
+	}
+
+	if (JSValueIsNull(eng->context, arguments[0]) ||
+		// Might need to check if JSValueIsObject? Who knows with WebKit.
+		!JSValueIsObjectOfClass(eng->context, arguments[0], seed_struct_class))
+	{
+		seed_make_exception(exception, "ArgumentError",
+							"Property installation expected a "
+							"GParamSpec as argument");
+		return JSValueMakeNull(eng->context);
+	}
+
+	spec = (GParamSpec *) seed_pointer_get_pointer(arguments[0]);
+
+	oldcount = seed_object_get_property(thisObject, "property_count");
+	property_count = seed_value_to_int(oldcount, exception);
+
+	class = seed_pointer_get_pointer(thisObject);
+	g_object_class_install_property(class, property_count, spec);
+
+	newcount = seed_value_from_int(property_count + 1, exception);
+	seed_object_set_property(thisObject, "property_count", newcount);
+
+	return oldcount;
 }
 
 static JSValueRef
 seed_gsignal_method_invoked(JSContextRef ctx,
-			    JSObjectRef function,
-			    JSObjectRef thisObject,
-			    size_t argumentCount,
-			    const JSValueRef arguments[],
-			    JSValueRef * exception)
-{
-    // TODO: class_closure, and accumlator. Not useful until we have structs.
-    JSValueRef jsname, jstype, jsflags, jsreturn_type, jsparams, ret;
-    GType itype, return_type;
-    guint n_params = 0;
-    GType * param_types = 0;
-    gchar * name;
-    guint signal_id;
-    GSignalFlags flags;
-
-    /* Sanity check */
-    if (argumentCount != 1)
-    {
-	gchar * mes = g_strdup_printf("Signal constructor expected 1 argument",
-				      " got %d \n", argumentCount);
-	seed_make_exception(exception, "ArgumentError", mes);
-	g_free(mes);
-	return (JSObjectRef)JSValueMakeNull(eng->context);
-    }
-    if (JSValueIsNull(eng->context, arguments[0]) || 
-	!JSValueIsObject(eng->context, arguments[0]))
-    {
-	seed_make_exception(exception, "ArgumentError",
-			    "Signal constructor expected object"
-			    " as first argument");
- 	return (JSObjectRef)JSValueMakeNull(eng->context);
-    }
-
-
-    /* Signal name */
-    jsname = seed_object_get_property((JSObjectRef)arguments[0], "name");
-    /* seed_value_to_string can handle non strings, however the kind
-     * of strings we want as a signal name are rather small, so make sure
-     * we have an actual string */
-    if (JSValueIsNull(eng->context, jsname) || 
-	!JSValueIsString(eng->context, jsname))
-    {
-	seed_make_exception(exception, "ArgumentError",
-			    "Signal definition needs name property");
-	return (JSObjectRef)JSValueMakeNull(eng->context);
-    }
-    name = seed_value_to_string(jsname, exception);
-    
-    /* Type to install on. Comes from class. */
-    jstype = seed_object_get_property(thisObject, "type");
-    itype = seed_value_to_int(jstype, exception);
-    
-    /* Signal flags */
-    jsflags = seed_object_get_property((JSObjectRef)arguments[0], "flags");
-    if (JSValueIsNull(eng->context, jsflags) || 
-	!JSValueIsNumber(eng->context, jsflags))
-	flags = G_SIGNAL_RUN_LAST;
-    else
-	flags = seed_value_to_long(jsflags, exception);
-    
-    
-    /* Return type */
-    jsreturn_type = seed_object_get_property((JSObjectRef)arguments[0],
-					    "return_type");
-    if (JSValueIsNull(eng->context, jsreturn_type) || 
-	!JSValueIsNumber(eng->context, jsreturn_type))
-	return_type = G_TYPE_NONE;
-    else
-	return_type = seed_value_to_int(jsreturn_type, exception);
-
-    /* Number of params and types */
-    jsparams = seed_object_get_property((JSObjectRef)arguments[0],
-				       "parameters");
-    if (!JSValueIsNull(eng->context, jsparams) &&
-	JSValueIsObject(eng->context, jsparams))
-    {
-	n_params = seed_value_to_int
-	    (seed_object_get_property((JSObjectRef)jsparams, "length"), 
-	     exception);
-	if (n_params > 0)
-	{
-	    guint i;
-	    
-	    param_types = g_new0(GType, n_params);
-	    for (i = 0; i < n_params; i++)
-	    {
-		JSValueRef ptype = 
-		    JSObjectGetPropertyAtIndex(eng->context,
-					       (JSObjectRef)jsparams, 
-					       i,
-					       exception);
-		
-		param_types[i] = seed_value_to_int(ptype, exception);
-	    }
-	}
-    }   
-    
-    signal_id = g_signal_newv(name, itype,
-			      flags, 0, 0, 0, 
-			      g_cclosure_marshal_generic_ffi,
-			      return_type,
-			      n_params,
-			      param_types);
-    
-    g_free(name);
-    g_free(param_types);
-    
-    return (JSValueRef)seed_value_from_uint(signal_id, exception);
-}
+							JSObjectRef function,
+							JSObjectRef thisObject,
+							size_t argumentCount,
+							const JSValueRef arguments[],
+							JSValueRef * exception)
+{
+	// TODO: class_closure, and accumlator. Not useful until we have structs.
+	JSValueRef jsname, jstype, jsflags, jsreturn_type, jsparams, ret;
+	GType itype, return_type;
+	guint n_params = 0;
+	GType *param_types = 0;
+	gchar *name;
+	guint signal_id;
+	GSignalFlags flags;
 
+	/* Sanity check */
+	if (argumentCount != 1)
+	{
+		gchar *mes = g_strdup_printf("Signal constructor expected 1 argument",
+									 " got %d \n", argumentCount);
+		seed_make_exception(exception, "ArgumentError", mes);
+		g_free(mes);
+		return (JSObjectRef) JSValueMakeNull(eng->context);
+	}
+	if (JSValueIsNull(eng->context, arguments[0]) ||
+		!JSValueIsObject(eng->context, arguments[0]))
+	{
+		seed_make_exception(exception, "ArgumentError",
+							"Signal constructor expected object"
+							" as first argument");
+		return (JSObjectRef) JSValueMakeNull(eng->context);
+	}
 
+	/* Signal name */
+	jsname = seed_object_get_property((JSObjectRef) arguments[0], "name");
+	/* seed_value_to_string can handle non strings, however the kind
+	 * of strings we want as a signal name are rather small, so make sure
+	 * we have an actual string */
+	if (JSValueIsNull(eng->context, jsname) ||
+		!JSValueIsString(eng->context, jsname))
+	{
+		seed_make_exception(exception, "ArgumentError",
+							"Signal definition needs name property");
+		return (JSObjectRef) JSValueMakeNull(eng->context);
+	}
+	name = seed_value_to_string(jsname, exception);
+
+	/* Type to install on. Comes from class. */
+	jstype = seed_object_get_property(thisObject, "type");
+	itype = seed_value_to_int(jstype, exception);
+
+	/* Signal flags */
+	jsflags = seed_object_get_property((JSObjectRef) arguments[0], "flags");
+	if (JSValueIsNull(eng->context, jsflags) ||
+		!JSValueIsNumber(eng->context, jsflags))
+		flags = G_SIGNAL_RUN_LAST;
+	else
+		flags = seed_value_to_long(jsflags, exception);
+
+	/* Return type */
+	jsreturn_type = seed_object_get_property((JSObjectRef) arguments[0],
+											 "return_type");
+	if (JSValueIsNull(eng->context, jsreturn_type) ||
+		!JSValueIsNumber(eng->context, jsreturn_type))
+		return_type = G_TYPE_NONE;
+	else
+		return_type = seed_value_to_int(jsreturn_type, exception);
+
+	/* Number of params and types */
+	jsparams = seed_object_get_property((JSObjectRef) arguments[0],
+										"parameters");
+	if (!JSValueIsNull(eng->context, jsparams) &&
+		JSValueIsObject(eng->context, jsparams))
+	{
+		n_params = seed_value_to_int
+			(seed_object_get_property((JSObjectRef) jsparams, "length"),
+			 exception);
+		if (n_params > 0)
+		{
+			guint i;
+
+			param_types = g_new0(GType, n_params);
+			for (i = 0; i < n_params; i++)
+			{
+				JSValueRef ptype = JSObjectGetPropertyAtIndex(eng->context,
+															  (JSObjectRef)
+															  jsparams,
+															  i,
+															  exception);
+
+				param_types[i] = seed_value_to_int(ptype, exception);
+			}
+		}
+	}
+
+	signal_id = g_signal_newv(name, itype,
+							  flags, 0, 0, 0,
+							  g_cclosure_marshal_generic_ffi,
+							  return_type, n_params, param_types);
+
+	g_free(name);
+	g_free(param_types);
+
+	return (JSValueRef) seed_value_from_uint(signal_id, exception);
+}
 
 static void
 seed_handle_class_init_closure(ffi_cif * cif,
-			       void *result, void **args, void *userdata)
+							   void *result, void **args, void *userdata)
 {
-    JSObjectRef function = (JSObjectRef) userdata;
-    JSValueRef jsargs[2];
-    GType type;
-    JSValueRef exception = 0;
-
-    type = (GType) JSObjectGetPrivate(*(JSObjectRef *) args[1]);
-    jsargs[0] = seed_make_pointer(*(gpointer *) args[0]);
-    jsargs[1] = seed_gobject_get_prototype_for_gtype(type);
-
-    // TODO: 
-    // Should probably have a custom type for class, and have it auto convert.
-    seed_object_set_property((JSObjectRef)jsargs[0], 
-			    "type", seed_value_from_int(type, 0));
-    seed_object_set_property((JSObjectRef)jsargs[0],
-			     "property_count", seed_value_from_int(1, 0));
-    seed_create_function("install_signal",
-			 &seed_gsignal_method_invoked,
-			 (JSObjectRef)jsargs[0]);
-    seed_create_function("install_property",
-			 &seed_property_method_invoked,
-			 (JSObjectRef)jsargs[0]);
-
-    JSObjectCallAsFunction(eng->context, function, 0, 2, jsargs, 0);
-    if (exception)
-    {
-	gchar *mes = seed_exception_to_string(exception);
-	g_warning("Exception in class init closure. %s \n", mes, 0);
-    }
+	JSObjectRef function = (JSObjectRef) userdata;
+	JSValueRef jsargs[2];
+	GType type;
+	JSValueRef exception = 0;
+
+	type = (GType) JSObjectGetPrivate(*(JSObjectRef *) args[1]);
+	jsargs[0] = seed_make_pointer(*(gpointer *) args[0]);
+	jsargs[1] = seed_gobject_get_prototype_for_gtype(type);
+
+	// TODO: 
+	// Should probably have a custom type for class, and have it auto convert.
+	seed_object_set_property((JSObjectRef) jsargs[0],
+							 "type", seed_value_from_int(type, 0));
+	seed_object_set_property((JSObjectRef) jsargs[0],
+							 "property_count", seed_value_from_int(1, 0));
+	seed_create_function("install_signal",
+						 &seed_gsignal_method_invoked, (JSObjectRef) jsargs[0]);
+	seed_create_function("install_property",
+						 &seed_property_method_invoked,
+						 (JSObjectRef) jsargs[0]);
+
+	JSObjectCallAsFunction(eng->context, function, 0, 2, jsargs, 0);
+	if (exception)
+	{
+		gchar *mes = seed_exception_to_string(exception);
+		g_warning("Exception in class init closure. %s \n", mes, 0);
+	}
 }
 
 static void
 seed_handle_instance_init_closure(ffi_cif * cif,
-				  void *result, void **args, void *userdata)
+								  void *result, void **args, void *userdata)
 {
-    JSObjectRef function = (JSObjectRef) userdata;
-    JSValueRef jsargs;
-    JSValueRef exception = 0;
-    JSObjectRef this_object;
-
-    jsargs = seed_make_pointer(*(gpointer *) args[1]);
-    this_object =
-	(JSObjectRef) seed_value_from_object(*(GObject **) args[0], 0);
-
-    JSObjectCallAsFunction(eng->context, function, this_object, 1, &jsargs,
-			   &exception);
-    if (exception)
-    {
-	gchar *mes = seed_exception_to_string(exception);
-	g_warning("Exception in instance init closure. %s \n", mes, 0);
-    }
+	JSObjectRef function = (JSObjectRef) userdata;
+	JSValueRef jsargs;
+	JSValueRef exception = 0;
+	JSObjectRef this_object;
+
+	jsargs = seed_make_pointer(*(gpointer *) args[1]);
+	this_object =
+		(JSObjectRef) seed_value_from_object(*(GObject **) args[0], 0);
+
+	JSObjectCallAsFunction(eng->context, function, this_object, 1, &jsargs,
+						   &exception);
+	if (exception)
+	{
+		gchar *mes = seed_exception_to_string(exception);
+		g_warning("Exception in instance init closure. %s \n", mes, 0);
+	}
 
 }
 
 static void
 seed_handle_set_property_closure(ffi_cif * cif,
-				  void *result, void **args, void *userdata)
+								 void *result, void **args, void *userdata)
 {
-    JSObjectRef function = (JSObjectRef) userdata;
-    JSValueRef jsargs[2];
-    JSValueRef exception = 0;
-    JSObjectRef this_object;
-    GParamSpec * spec;
-
-    this_object =
-	(JSObjectRef) seed_value_from_object(*(GObject **) args[0], &exception);
-    spec = *(GParamSpec **)args[3];
-    
-    jsargs[0] = seed_value_from_string(spec->name, &exception);
-    jsargs[1] = seed_value_from_gvalue(*(GValue **) args[2], &exception);
-
-    JSObjectCallAsFunction(eng->context, function, this_object, 2, jsargs,
-			   &exception);
-    if (exception)
-    {
-	gchar *mes = seed_exception_to_string(exception);
-	g_warning("Exception in set property closure. %s \n", mes, 0);
-    }
+	JSObjectRef function = (JSObjectRef) userdata;
+	JSValueRef jsargs[2];
+	JSValueRef exception = 0;
+	JSObjectRef this_object;
+	GParamSpec *spec;
+
+	this_object =
+		(JSObjectRef) seed_value_from_object(*(GObject **) args[0], &exception);
+	spec = *(GParamSpec **) args[3];
+
+	jsargs[0] = seed_value_from_string(spec->name, &exception);
+	jsargs[1] = seed_value_from_gvalue(*(GValue **) args[2], &exception);
+
+	JSObjectCallAsFunction(eng->context, function, this_object, 2, jsargs,
+						   &exception);
+	if (exception)
+	{
+		gchar *mes = seed_exception_to_string(exception);
+		g_warning("Exception in set property closure. %s \n", mes, 0);
+	}
 
 }
 
 static ffi_closure *seed_make_class_init_closure(JSObjectRef function)
 {
-    ffi_cif *cif;
-    ffi_closure *closure;
-    ffi_type **arg_types;;
-    ffi_arg result;
-    ffi_status status;
-
-    JSValueProtect(eng->context, function);
-
-    cif = g_new0(ffi_cif, 1);
-    arg_types = g_new0(ffi_type *, 3);
-
-    arg_types[0] = &ffi_type_pointer;
-    arg_types[1] = &ffi_type_uint;
-    arg_types[2] = 0;
-
-    closure = mmap(0, sizeof(ffi_closure), PROT_READ | PROT_WRITE |
-		   PROT_EXEC, MAP_ANON | MAP_PRIVATE, -1, 0);
-
-    ffi_prep_cif(cif, FFI_DEFAULT_ABI, 2, &ffi_type_void, arg_types);
-    ffi_prep_closure(closure, cif, seed_handle_class_init_closure, function);
-    return closure;
+	ffi_cif *cif;
+	ffi_closure *closure;
+	ffi_type **arg_types;;
+	ffi_arg result;
+	ffi_status status;
+
+	JSValueProtect(eng->context, function);
+
+	cif = g_new0(ffi_cif, 1);
+	arg_types = g_new0(ffi_type *, 3);
+
+	arg_types[0] = &ffi_type_pointer;
+	arg_types[1] = &ffi_type_uint;
+	arg_types[2] = 0;
+
+	closure = mmap(0, sizeof(ffi_closure), PROT_READ | PROT_WRITE |
+				   PROT_EXEC, MAP_ANON | MAP_PRIVATE, -1, 0);
+
+	ffi_prep_cif(cif, FFI_DEFAULT_ABI, 2, &ffi_type_void, arg_types);
+	ffi_prep_closure(closure, cif, seed_handle_class_init_closure, function);
+	return closure;
 }
 
 static ffi_closure *seed_make_instance_init_closure(JSObjectRef function)
 {
-    ffi_cif *cif;
-    ffi_closure *closure;
-    ffi_type **arg_types;;
-    ffi_arg result;
-    ffi_status status;
-
-    JSValueProtect(eng->context, function);
-
-    cif = g_new0(ffi_cif, 1);
-    arg_types = g_new0(ffi_type *, 3);
-
-    arg_types[0] = &ffi_type_pointer;
-    arg_types[1] = &ffi_type_pointer;
-    arg_types[2] = 0;
-
-    closure = mmap(0, sizeof(ffi_closure), PROT_READ | PROT_WRITE |
-		   PROT_EXEC, MAP_ANON | MAP_PRIVATE, -1, 0);
-
-    ffi_prep_cif(cif, FFI_DEFAULT_ABI, 2, &ffi_type_void, arg_types);
-    ffi_prep_closure(closure, cif, seed_handle_instance_init_closure, function);
-    return closure;
+	ffi_cif *cif;
+	ffi_closure *closure;
+	ffi_type **arg_types;;
+	ffi_arg result;
+	ffi_status status;
+
+	JSValueProtect(eng->context, function);
+
+	cif = g_new0(ffi_cif, 1);
+	arg_types = g_new0(ffi_type *, 3);
+
+	arg_types[0] = &ffi_type_pointer;
+	arg_types[1] = &ffi_type_pointer;
+	arg_types[2] = 0;
+
+	closure = mmap(0, sizeof(ffi_closure), PROT_READ | PROT_WRITE |
+				   PROT_EXEC, MAP_ANON | MAP_PRIVATE, -1, 0);
+
+	ffi_prep_cif(cif, FFI_DEFAULT_ABI, 2, &ffi_type_void, arg_types);
+	ffi_prep_closure(closure, cif, seed_handle_instance_init_closure, function);
+	return closure;
 }
 
 static ffi_closure *seed_make_set_property_closure(JSObjectRef function)
 {
-    ffi_cif *cif;
-    ffi_closure *closure;
-    ffi_type **arg_types;;
-    ffi_arg result;
-    ffi_status status;
-
-    JSValueProtect(eng->context, function);
-
-    cif = g_new0(ffi_cif, 1);
-    arg_types = g_new0(ffi_type *, 5);
-
-    arg_types[0] = &ffi_type_pointer;
-    arg_types[1] = &ffi_type_uint;
-    arg_types[2] = &ffi_type_pointer;
-    arg_types[3] = &ffi_type_pointer;
-    arg_types[4] = 0;
-
-    closure = mmap(0, sizeof(ffi_closure), PROT_READ | PROT_WRITE |
-		   PROT_EXEC, MAP_ANON | MAP_PRIVATE, -1, 0);
-
-    ffi_prep_cif(cif, FFI_DEFAULT_ABI, 4, &ffi_type_void, arg_types);
-    ffi_prep_closure(closure, cif, seed_handle_set_property_closure, function);
-    return closure;
+	ffi_cif *cif;
+	ffi_closure *closure;
+	ffi_type **arg_types;;
+	ffi_arg result;
+	ffi_status status;
+
+	JSValueProtect(eng->context, function);
+
+	cif = g_new0(ffi_cif, 1);
+	arg_types = g_new0(ffi_type *, 5);
+
+	arg_types[0] = &ffi_type_pointer;
+	arg_types[1] = &ffi_type_uint;
+	arg_types[2] = &ffi_type_pointer;
+	arg_types[3] = &ffi_type_pointer;
+	arg_types[4] = 0;
+
+	closure = mmap(0, sizeof(ffi_closure), PROT_READ | PROT_WRITE |
+				   PROT_EXEC, MAP_ANON | MAP_PRIVATE, -1, 0);
+
+	ffi_prep_cif(cif, FFI_DEFAULT_ABI, 4, &ffi_type_void, arg_types);
+	ffi_prep_closure(closure, cif, seed_handle_set_property_closure, function);
+	return closure;
 }
 
 static JSObjectRef
 seed_gtype_constructor_invoked(JSContextRef ctx,
-			       JSObjectRef constructor,
-			       size_t argumentCount,
-			       const JSValueRef arguments[],
-			       JSValueRef * exception)
-{
-    JSValueRef class_init, instance_init, name, parent_ref, set_property_ref;
-    GType parent_type, new_type;
-    gchar *new_name;
-    GTypeInfo type_info = {
-	0,
-	(GBaseInitFunc) NULL,
-	(GBaseFinalizeFunc) NULL,
-	(GClassInitFunc) NULL,
-	(GClassFinalizeFunc) NULL,
-	NULL,
-	0,
-	0,
-	NULL
-    };
-    ffi_closure *init_closure = 0;
-    ffi_closure *instance_init_closure = 0;
-
-    GTypeQuery query;
-    JSObjectRef constructor_ref;
-
-    if (argumentCount != 1)
-    {
-	gchar *mes =
-	    g_strdup_printf("GType constructor expected 1 "
-			    "argument, got %d \n",
-			    argumentCount);
-	seed_make_exception(exception, "ArgumentError", mes);
-	g_free(mes);
-	return (JSObjectRef) JSValueMakeNull(eng->context);
-    }
-    if (!JSValueIsObject(eng->context, arguments[0]))
-    {
-	seed_make_exception(exception, "ArgumentError",
-			    "GType constructor expected a"
-			    "class definition object. Got a nonobject");
-
-	return (JSObjectRef)JSValueMakeNull(eng->context);
-    }
-    parent_ref = seed_object_get_property((JSObjectRef)arguments[0], 
-					  "parent");
-    class_init = seed_object_get_property((JSObjectRef)arguments[0], 
-					  "class_init");
-    instance_init = seed_object_get_property((JSObjectRef)arguments[0], 
-					     "instance_init");
-    name = seed_object_get_property((JSObjectRef)arguments[0], 
-				    "name");
-
-    new_name = seed_value_to_string(name, exception);
-    if (!JSValueIsNumber(eng->context,
-			 parent_ref))
-    {
-	seed_make_exception(exception, "TypeError",
-			    "GType constructor expected"
-			    " Gype for parent");
-	
-	return (JSObjectRef)JSValueMakeNull(eng->context);
-    }
-    if (!JSValueIsNull(eng->context, class_init) &&
-	JSValueIsObject(eng->context, class_init) &&
-	JSObjectIsFunction(eng->context, (JSObjectRef) class_init))
-    {
-	init_closure = seed_make_class_init_closure((JSObjectRef) class_init);
-    }
-    if (!JSValueIsNull(eng->context, instance_init) &&
-	JSValueIsObject(eng->context, instance_init) &&
-	JSObjectIsFunction(eng->context, (JSObjectRef) instance_init))
-    {
-	instance_init_closure =
-	    seed_make_instance_init_closure((JSObjectRef) instance_init);
-    }
-
-    parent_type = (GType) seed_value_to_int(parent_ref, exception);
-
-    g_type_query(parent_type, &query);
-    type_info.class_size = query.class_size;
-    type_info.instance_size = query.instance_size;
-    type_info.class_init = (GClassInitFunc) init_closure;
-    type_info.instance_init = (GInstanceInitFunc) instance_init_closure;
-
-    constructor_ref = JSObjectMake(eng->context, gobject_constructor_class,
-				   (gpointer) new_type);
-    JSValueProtect(eng->context, constructor_ref);
-
-    type_info.class_data = constructor_ref;
-
-    new_type = g_type_register_static(parent_type, new_name, &type_info, 0);
-    seed_gobject_get_class_for_gtype(new_type);
-    JSObjectSetPrivate(constructor_ref, (gpointer) new_type);
-
-    g_free(new_name);
-    return JSObjectMake(eng->context, gobject_constructor_class,
-			(gpointer) new_type);
+							   JSObjectRef constructor,
+							   size_t argumentCount,
+							   const JSValueRef arguments[],
+							   JSValueRef * exception)
+{
+	JSValueRef class_init, instance_init, name, parent_ref, set_property_ref;
+	GType parent_type, new_type;
+	gchar *new_name;
+	GTypeInfo type_info = {
+		0,
+		(GBaseInitFunc) NULL,
+		(GBaseFinalizeFunc) NULL,
+		(GClassInitFunc) NULL,
+		(GClassFinalizeFunc) NULL,
+		NULL,
+		0,
+		0,
+		NULL
+	};
+	ffi_closure *init_closure = 0;
+	ffi_closure *instance_init_closure = 0;
+
+	GTypeQuery query;
+	JSObjectRef constructor_ref;
+
+	if (argumentCount != 1)
+	{
+		gchar *mes =
+			g_strdup_printf("GType constructor expected 1 "
+							"argument, got %d \n",
+							argumentCount);
+		seed_make_exception(exception, "ArgumentError", mes);
+		g_free(mes);
+		return (JSObjectRef) JSValueMakeNull(eng->context);
+	}
+	if (!JSValueIsObject(eng->context, arguments[0]))
+	{
+		seed_make_exception(exception, "ArgumentError",
+							"GType constructor expected a"
+							"class definition object. Got a nonobject");
+
+		return (JSObjectRef) JSValueMakeNull(eng->context);
+	}
+	parent_ref = seed_object_get_property((JSObjectRef) arguments[0], "parent");
+	class_init = seed_object_get_property((JSObjectRef) arguments[0],
+										  "class_init");
+	instance_init = seed_object_get_property((JSObjectRef) arguments[0],
+											 "instance_init");
+	name = seed_object_get_property((JSObjectRef) arguments[0], "name");
+
+	new_name = seed_value_to_string(name, exception);
+	if (!JSValueIsNumber(eng->context, parent_ref))
+	{
+		seed_make_exception(exception, "TypeError",
+							"GType constructor expected" " Gype for parent");
+
+		return (JSObjectRef) JSValueMakeNull(eng->context);
+	}
+	if (!JSValueIsNull(eng->context, class_init) &&
+		JSValueIsObject(eng->context, class_init) &&
+		JSObjectIsFunction(eng->context, (JSObjectRef) class_init))
+	{
+		init_closure = seed_make_class_init_closure((JSObjectRef) class_init);
+	}
+	if (!JSValueIsNull(eng->context, instance_init) &&
+		JSValueIsObject(eng->context, instance_init) &&
+		JSObjectIsFunction(eng->context, (JSObjectRef) instance_init))
+	{
+		instance_init_closure =
+			seed_make_instance_init_closure((JSObjectRef) instance_init);
+	}
+
+	parent_type = (GType) seed_value_to_int(parent_ref, exception);
+
+	g_type_query(parent_type, &query);
+	type_info.class_size = query.class_size;
+	type_info.instance_size = query.instance_size;
+	type_info.class_init = (GClassInitFunc) init_closure;
+	type_info.instance_init = (GInstanceInitFunc) instance_init_closure;
+
+	constructor_ref = JSObjectMake(eng->context, gobject_constructor_class,
+								   (gpointer) new_type);
+	JSValueProtect(eng->context, constructor_ref);
+
+	type_info.class_data = constructor_ref;
+
+	new_type = g_type_register_static(parent_type, new_name, &type_info, 0);
+	seed_gobject_get_class_for_gtype(new_type);
+	JSObjectSetPrivate(constructor_ref, (gpointer) new_type);
+
+	g_free(new_name);
+	return JSObjectMake(eng->context, gobject_constructor_class,
+						(gpointer) new_type);
 }
 
 void seed_gtype_init(void)
 {
-    JSClassDefinition gtype_def = kJSClassDefinitionEmpty;
-    JSObjectRef gtype_constructor;
+	JSClassDefinition gtype_def = kJSClassDefinitionEmpty;
+	JSObjectRef gtype_constructor;
 
-    gtype_def.callAsConstructor = seed_gtype_constructor_invoked;
-    seed_gtype_class = JSClassCreate(&gtype_def);
-    JSClassRetain(seed_gtype_class);
+	gtype_def.callAsConstructor = seed_gtype_constructor_invoked;
+	seed_gtype_class = JSClassCreate(&gtype_def);
+	JSClassRetain(seed_gtype_class);
 
-    gtype_constructor = JSObjectMake(eng->context, seed_gtype_class, 0);
+	gtype_constructor = JSObjectMake(eng->context, seed_gtype_class, 0);
 
-    seed_object_set_property(eng->global, "GType", gtype_constructor);
+	seed_object_set_property(eng->global, "GType", gtype_constructor);
 }

Modified: trunk/libseed/seed-private.h
==============================================================================
--- trunk/libseed/seed-private.h	(original)
+++ trunk/libseed/seed-private.h	Sat Nov 22 19:00:31 2008
@@ -33,8 +33,8 @@
 typedef struct _SeedEngine SeedEngine;
 
 struct _SeedEngine {
-    JSGlobalContextRef context;
-    JSObjectRef global;
+	JSGlobalContextRef context;
+	JSObjectRef global;
 };
 
 #include "seed-debug.h"

Modified: trunk/libseed/seed-signals.c
==============================================================================
--- trunk/libseed/seed-signals.c	(original)
+++ trunk/libseed/seed-signals.c	Sat Nov 22 19:00:31 2008
@@ -24,302 +24,295 @@
 #include "seed-private.h"
 
 typedef struct _signal_privates {
-    guint signal_id;
-    GObject *object;
+	guint signal_id;
+	GObject *object;
 } signal_privates;
 
 JSClassRef signal_holder_class;
 
-static void
-seed_signal_finalize(JSObjectRef object)
+static void seed_signal_finalize(JSObjectRef object)
 {
-    signal_privates * sig_priv = JSObjectGetPrivate(object);
+	signal_privates *sig_priv = JSObjectGetPrivate(object);
 
-    g_free(sig_priv);
+	g_free(sig_priv);
 }
-		    
 
 static void
 seed_add_signal_to_object(JSObjectRef object_ref,
-			  GObject * obj, GSignalQuery * signal)
+						  GObject * obj, GSignalQuery * signal)
 {
-    guint k;
-    JSObjectRef signal_ref;
-    signal_privates *priv = g_malloc(sizeof(signal_privates));
-    gchar *js_signal_name = g_strdup(signal->signal_name);
-    g_assert(signal);
-
-    for (k = 0; k < strlen(js_signal_name); k++)
-    {
-	if (js_signal_name[k] == '-')
-	    js_signal_name[k] = '_';
-    }
+	guint k;
+	JSObjectRef signal_ref;
+	signal_privates *priv = g_malloc(sizeof(signal_privates));
+	gchar *js_signal_name = g_strdup(signal->signal_name);
+	g_assert(signal);
+
+	for (k = 0; k < strlen(js_signal_name); k++)
+	{
+		if (js_signal_name[k] == '-')
+			js_signal_name[k] = '_';
+	}
 
-    signal_ref = JSObjectMake(eng->context, gobject_signal_class, priv);
+	signal_ref = JSObjectMake(eng->context, gobject_signal_class, priv);
 
-    priv->signal_id = signal->signal_id;
-    priv->object = obj;
+	priv->signal_id = signal->signal_id;
+	priv->object = obj;
 
-    seed_object_set_property(object_ref, js_signal_name, signal_ref);
-    g_free(js_signal_name);
+	seed_object_set_property(object_ref, js_signal_name, signal_ref);
+	g_free(js_signal_name);
 }
 
 static void
 seed_add_signals_for_type(JSObjectRef object_ref, GObject * obj, GType type)
 {
-    guint n, i;
-    guint *signal_ids;
-    GSignalQuery query;
-    signal_ids = g_signal_list_ids(type, &n);
-    for (i = 0; i < n; i++)
-    {
-	g_signal_query(signal_ids[i], &query);
-	if (query.signal_id != 0)
+	guint n, i;
+	guint *signal_ids;
+	GSignalQuery query;
+	signal_ids = g_signal_list_ids(type, &n);
+	for (i = 0; i < n; i++)
 	{
-	    seed_add_signal_to_object(object_ref, obj, &query);
+		g_signal_query(signal_ids[i], &query);
+		if (query.signal_id != 0)
+		{
+			seed_add_signal_to_object(object_ref, obj, &query);
+		}
 	}
-    }
-    g_free(signal_ids);
+	g_free(signal_ids);
 }
 
 void seed_add_signals_to_object(JSObjectRef object_ref, GObject * obj)
 {
-    GType type;
-    GType *interfaces;
-    guint n, i;
-    JSObjectRef signals_ref;
+	GType type;
+	GType *interfaces;
+	guint n, i;
+	JSObjectRef signals_ref;
 
-    g_assert(obj);
+	g_assert(obj);
 
-    type = G_OBJECT_TYPE(obj);
+	type = G_OBJECT_TYPE(obj);
 
-    signals_ref = JSObjectMake(eng->context, signal_holder_class, 0);
+	signals_ref = JSObjectMake(eng->context, signal_holder_class, 0);
 
-    while (type != 0)
-    {
-	seed_add_signals_for_type(signals_ref, obj, type);
+	while (type != 0)
+	{
+		seed_add_signals_for_type(signals_ref, obj, type);
 
-	interfaces = g_type_interfaces(type, &n);
-	for (i = 0; i < n; i++)
-	    seed_add_signals_for_type(signals_ref, obj, interfaces[i]);
+		interfaces = g_type_interfaces(type, &n);
+		for (i = 0; i < n; i++)
+			seed_add_signals_for_type(signals_ref, obj, interfaces[i]);
 
-	type = g_type_parent(type);
+		type = g_type_parent(type);
 
-	g_free(interfaces);
-    }
+		g_free(interfaces);
+	}
 
-    seed_object_set_property(object_ref, "signal", signals_ref);
+	seed_object_set_property(object_ref, "signal", signals_ref);
 }
 
 void
 seed_signal_marshal_func(GClosure * closure,
-			 GValue * return_value,
-			 guint n_param_values,
-			 const GValue * param_values,
-			 gpointer invocation_hint, gpointer marshall_data)
+						 GValue * return_value,
+						 guint n_param_values,
+						 const GValue * param_values,
+						 gpointer invocation_hint, gpointer marshall_data)
 {
-    SeedClosure *seed_closure = (SeedClosure *) closure;
-    JSValueRef *args, exception = 0;
-    JSValueRef ret = 0;
-    gint i;
+	SeedClosure *seed_closure = (SeedClosure *) closure;
+	JSValueRef *args, exception = 0;
+	JSValueRef ret = 0;
+	gint i;
 
-    args = g_newa(JSValueRef, n_param_values + 1);
+	args = g_newa(JSValueRef, n_param_values + 1);
 
-    for (i = 0; i < n_param_values; i++)
-    {
-	args[i] = seed_value_from_gvalue((GValue *) & param_values[i], 0);
+	for (i = 0; i < n_param_values; i++)
+	{
+		args[i] = seed_value_from_gvalue((GValue *) & param_values[i], 0);
 
-	if (!args[i])
-	    g_error("Error in signal marshal. "
-		    "Unable to convert argument of type: %s \n",
-		    g_type_name(param_values[i].g_type));
+		if (!args[i])
+			g_error("Error in signal marshal. "
+					"Unable to convert argument of type: %s \n",
+					g_type_name(param_values[i].g_type));
 
-    }
+	}
 
-    if (seed_closure->user_data)
+	if (seed_closure->user_data)
 		args[i] = seed_closure->user_data;
-    else
+	else
 		args[i] = JSValueMakeNull(eng->context);
-	
-    ret = JSObjectCallAsFunction(eng->context, seed_closure->function,
-			   seed_closure->this,
-			   n_param_values + 1, args, &exception);
-
-    if (exception)
-    {
-	gchar *mes = seed_exception_to_string(exception);
-	g_warning("Exception in signal handler. %s \n", 
-		  mes, 0);
-	g_free(mes);
-	exception = 0;
-    }
-
-    if (ret && !JSValueIsNull(eng->context, ret) 
-	&& (seed_closure->return_type != G_TYPE_NONE))
-    {
-	seed_gvalue_from_seed_value(ret, seed_closure->return_type,
-				    return_value, &exception);
-
-    }
-
-    if (exception)
-    {
-	gchar *mes = seed_exception_to_string(exception);
-	g_warning("Exception in signal handler return value. %s \n", 
-		  mes, 0);
-	g_free(mes);
-    }
 
+	ret = JSObjectCallAsFunction(eng->context, seed_closure->function,
+								 seed_closure->this,
+								 n_param_values + 1, args, &exception);
 
+	if (exception)
+	{
+		gchar *mes = seed_exception_to_string(exception);
+		g_warning("Exception in signal handler. %s \n", mes, 0);
+		g_free(mes);
+		exception = 0;
+	}
+
+	if (ret && !JSValueIsNull(eng->context, ret)
+		&& (seed_closure->return_type != G_TYPE_NONE))
+	{
+		seed_gvalue_from_seed_value(ret, seed_closure->return_type,
+									return_value, &exception);
+
+	}
+
+	if (exception)
+	{
+		gchar *mes = seed_exception_to_string(exception);
+		g_warning("Exception in signal handler return value. %s \n", mes, 0);
+		g_free(mes);
+	}
 
 }
 
 static JSValueRef
 seed_gobject_signal_emit(JSContextRef ctx,
-			    JSObjectRef function,
-			    JSObjectRef thisObject,
-			    size_t argumentCount,
-			    const JSValueRef arguments[],
-			    JSValueRef * exception)
+						 JSObjectRef function,
+						 JSObjectRef thisObject,
+						 size_t argumentCount,
+						 const JSValueRef arguments[], JSValueRef * exception)
 {
-    JSValueRef ret;
-    GValue * params;
-    GValue ret_value = {0};
-    GSignalQuery query;
-
-    signal_privates * privates;
-    guint i;
-
-    privates = JSObjectGetPrivate(thisObject);
-
-    g_signal_query(privates->signal_id,
-		   &query);
-    
-    if (argumentCount != query.n_params)
-    {
-	gchar * mes = g_strdup_printf("Signal: %s for type %s expected %d "
-				      "arguments, got %d",
-				      query.signal_name,
-				      g_type_name(query.itype),
-				      query.n_params,
-				      argumentCount);
-	seed_make_exception(exception, "ArgumentError", mes);
-	g_free(mes);
-	return JSValueMakeNull(eng->context);
-    }
-
-       
-    params = g_new0(GValue, argumentCount+1);
-   
-    g_value_init(&params[0], G_TYPE_OBJECT);
-    g_value_set_object(&params[0], privates->object);
-    for (i = 0; i < argumentCount; i++)
-	seed_gvalue_from_seed_value(arguments[i], 
-				    query.param_types[i],
-				    &params[i+1], exception);
-    
-    g_signal_emitv(params, privates->signal_id, 0, &ret_value);
-    
-    for (i = 0; i < argumentCount; i++)
-	g_value_unset(&params[i]);
-    g_free(params);
-    
-    ret = seed_value_from_gvalue(&ret_value, exception);
-    
-    return ret;    
+	JSValueRef ret;
+	GValue *params;
+	GValue ret_value = { 0 };
+	GSignalQuery query;
+
+	signal_privates *privates;
+	guint i;
+
+	privates = JSObjectGetPrivate(thisObject);
+
+	g_signal_query(privates->signal_id, &query);
+
+	if (argumentCount != query.n_params)
+	{
+		gchar *mes = g_strdup_printf("Signal: %s for type %s expected %d "
+									 "arguments, got %d",
+									 query.signal_name,
+									 g_type_name(query.itype),
+									 query.n_params,
+									 argumentCount);
+		seed_make_exception(exception, "ArgumentError", mes);
+		g_free(mes);
+		return JSValueMakeNull(eng->context);
+	}
+
+	params = g_new0(GValue, argumentCount + 1);
+
+	g_value_init(&params[0], G_TYPE_OBJECT);
+	g_value_set_object(&params[0], privates->object);
+	for (i = 0; i < argumentCount; i++)
+		seed_gvalue_from_seed_value(arguments[i],
+									query.param_types[i],
+									&params[i + 1], exception);
+
+	g_signal_emitv(params, privates->signal_id, 0, &ret_value);
+
+	for (i = 0; i < argumentCount; i++)
+		g_value_unset(&params[i]);
+	g_free(params);
+
+	ret = seed_value_from_gvalue(&ret_value, exception);
+
+	return ret;
 }
 
 static JSValueRef
 seed_gobject_signal_connect(JSContextRef ctx,
-			    JSObjectRef function,
-			    JSObjectRef thisObject,
-			    size_t argumentCount,
-			    const JSValueRef arguments[],
-			    JSValueRef * exception)
+							JSObjectRef function,
+							JSObjectRef thisObject,
+							size_t argumentCount,
+							const JSValueRef arguments[],
+							JSValueRef * exception)
 {
-    GSignalQuery query;
-    signal_privates *privates;
-    GClosure *closure;
-
-    privates = (signal_privates *) JSObjectGetPrivate(thisObject);
-    if (!privates)
-	g_error("Signal constructed with invalid parameters"
-		"in namespace import \n");
-
-    if ((argumentCount > 3) || (argumentCount == 0))
-    {
-	gchar *mes = g_strdup_printf("Signal connection expected"
-				     " 1, 2, or 3 arguments. Got "
-				     "%d", argumentCount);
-	seed_make_exception(exception, "ArgumentError", mes);
-
-	g_free(mes);
-	return JSValueMakeNull(eng->context);
-    }
-    
-    g_signal_query(privates->signal_id, &query);
-
-    closure = g_closure_new_simple(sizeof(SeedClosure), 0);
-    g_closure_set_marshal(closure, seed_signal_marshal_func);
-
-    ((SeedClosure *) closure)->function = (JSObjectRef) arguments[0];
-    ((SeedClosure *) closure)->object =
-	g_object_get_data(privates->object, "js-ref");
-    ((SeedClosure *) closure)->return_type = query.return_type;
-    if (argumentCount >= 2 && !JSValueIsNull(eng->context, arguments[1]))
-    {
-	JSValueProtect(eng->context, (JSObjectRef) arguments[1]);
-	((SeedClosure *) closure)->this = (JSObjectRef) arguments[1];
-    }
-    else
-	((SeedClosure *) closure)->this = 0;
-
-    if (argumentCount == 3)
-    {
-	((SeedClosure *) closure)->user_data = arguments[2];
-	JSValueProtect(eng->context, arguments[2]);
-    }
-
-    JSValueProtect(eng->context, (JSObjectRef) arguments[0]);
-
-    g_signal_connect_closure_by_id(privates->object,
-				   privates->signal_id, 0, closure, FALSE);
-    return 0;
+	GSignalQuery query;
+	signal_privates *privates;
+	GClosure *closure;
+
+	privates = (signal_privates *) JSObjectGetPrivate(thisObject);
+	if (!privates)
+		g_error("Signal constructed with invalid parameters"
+				"in namespace import \n");
+
+	if ((argumentCount > 3) || (argumentCount == 0))
+	{
+		gchar *mes = g_strdup_printf("Signal connection expected"
+									 " 1, 2, or 3 arguments. Got "
+									 "%d", argumentCount);
+		seed_make_exception(exception, "ArgumentError", mes);
+
+		g_free(mes);
+		return JSValueMakeNull(eng->context);
+	}
+
+	g_signal_query(privates->signal_id, &query);
+
+	closure = g_closure_new_simple(sizeof(SeedClosure), 0);
+	g_closure_set_marshal(closure, seed_signal_marshal_func);
+
+	((SeedClosure *) closure)->function = (JSObjectRef) arguments[0];
+	((SeedClosure *) closure)->object =
+		g_object_get_data(privates->object, "js-ref");
+	((SeedClosure *) closure)->return_type = query.return_type;
+	if (argumentCount >= 2 && !JSValueIsNull(eng->context, arguments[1]))
+	{
+		JSValueProtect(eng->context, (JSObjectRef) arguments[1]);
+		((SeedClosure *) closure)->this = (JSObjectRef) arguments[1];
+	}
+	else
+		((SeedClosure *) closure)->this = 0;
+
+	if (argumentCount == 3)
+	{
+		((SeedClosure *) closure)->user_data = arguments[2];
+		JSValueProtect(eng->context, arguments[2]);
+	}
+
+	JSValueProtect(eng->context, (JSObjectRef) arguments[0]);
+
+	g_signal_connect_closure_by_id(privates->object,
+								   privates->signal_id, 0, closure, FALSE);
+	return 0;
 }
 
 JSStaticFunction signal_static_functions[] =
-{ {"connect", seed_gobject_signal_connect, 0},
-  {"emit", seed_gobject_signal_emit, 0},
-  {0, 0, 0}
+	{ {"connect", seed_gobject_signal_connect, 0}
+,
+{"emit", seed_gobject_signal_emit, 0}
+,
+{0, 0, 0}
 };
 
 JSClassDefinition gobject_signal_def = {
-    0,				/* Version, always 0 */
-    kJSClassAttributeNoAutomaticPrototype,
-    "gobject_signal",		/* Class Name */
-    NULL,			/* Parent Class */
-    NULL,			/* Static Values */
-    signal_static_functions,	/* Static Functions */
-    NULL,
-    seed_signal_finalize,       /* Finalize */
-    NULL,			/* Has Property */
-    NULL,			/* Get Property */
-    NULL,			/* Set Property */
-    NULL,			/* Delete Property */
-    NULL,			/* Get Property Names */
-    NULL,			/* Call As Function */
-    NULL,			/* Call As Constructor */
-    NULL,			/* Has Instance */
-    NULL			/* Convert To Type */
+	0,							/* Version, always 0 */
+	kJSClassAttributeNoAutomaticPrototype,
+	"gobject_signal",			/* Class Name */
+	NULL,						/* Parent Class */
+	NULL,						/* Static Values */
+	signal_static_functions,	/* Static Functions */
+	NULL,
+	seed_signal_finalize,		/* Finalize */
+	NULL,						/* Has Property */
+	NULL,						/* Get Property */
+	NULL,						/* Set Property */
+	NULL,						/* Delete Property */
+	NULL,						/* Get Property Names */
+	NULL,						/* Call As Function */
+	NULL,						/* Call As Constructor */
+	NULL,						/* Has Instance */
+	NULL						/* Convert To Type */
 };
 
 JSClassDefinition *seed_get_signal_class(void)
 {
-    JSClassDefinition signal_holder = kJSClassDefinitionEmpty;
+	JSClassDefinition signal_holder = kJSClassDefinitionEmpty;
 
-    signal_holder.className = "gobject_signals";
-    signal_holder_class = JSClassCreate(&signal_holder);
-    JSClassRetain(signal_holder_class);
+	signal_holder.className = "gobject_signals";
+	signal_holder_class = JSClassCreate(&signal_holder);
+	JSClassRetain(signal_holder_class);
 
-    return &gobject_signal_def;
+	return &gobject_signal_def;
 }

Modified: trunk/libseed/seed-signals.h
==============================================================================
--- trunk/libseed/seed-signals.h	(original)
+++ trunk/libseed/seed-signals.h	Sat Nov 22 19:00:31 2008
@@ -25,10 +25,10 @@
 #include "seed-private.h"
 
 void seed_signal_marshal_func(GClosure * closure,
-			      GValue * return_value,
-			      guint n_param_values,
-			      const GValue * param_values,
-			      gpointer invocation_hint, gpointer marshall_data);
+							  GValue * return_value,
+							  guint n_param_values,
+							  const GValue * param_values,
+							  gpointer invocation_hint, gpointer marshall_data);
 
 void seed_add_signals_to_object(JSObjectRef object_ref, GObject * obj);
 JSClassDefinition *seed_get_signal_class(void);

Modified: trunk/libseed/seed-structs.c
==============================================================================
--- trunk/libseed/seed-structs.c	(original)
+++ trunk/libseed/seed-structs.c	Sat Nov 22 19:00:31 2008
@@ -26,418 +26,400 @@
 JSClassRef seed_pointer_class = 0;
 JSClassRef seed_boxed_class = 0;
 
-typedef struct _seed_struct_privates
-{
-    gpointer pointer;
-    GIBaseInfo * info;
+typedef struct _seed_struct_privates {
+	gpointer pointer;
+	GIBaseInfo *info;
 } seed_struct_privates;
 
 static void seed_pointer_finalize(JSObjectRef object)
 {
-    seed_struct_privates * priv =
-    	(seed_struct_privates *) JSObjectGetPrivate(object);
-    
-      g_free(priv);
+	seed_struct_privates *priv =
+		(seed_struct_privates *) JSObjectGetPrivate(object);
+
+	g_free(priv);
 }
 
 static void seed_boxed_finalize(JSObjectRef object)
 {
-    seed_struct_privates * priv =
-	(seed_struct_privates *) JSObjectGetPrivate(object);
-    GType type;
-    GIRegisteredTypeInfo * info = 
-	(GIRegisteredTypeInfo *)g_base_info_get_type(priv->info);
-    
-    type = g_registered_type_info_get_g_type(info);
-    g_base_info_unref((GIBaseInfo *) info);
-
-    g_boxed_free(type, priv->pointer);
-    
-}
-
-static GIFieldInfo * seed_union_find_field(GIUnionInfo * info,
-					   gchar * field_name)
-{
-    int n, i;
-    GIFieldInfo * field;
-    
-    n = g_union_info_get_n_fields(info);
-    for (i = 0; i < n; i++)
-    {
-	const gchar * name;
-	
-	field = g_union_info_get_field(info, i);
-	name = g_base_info_get_name((GIBaseInfo *) field);
-	if (!strcmp(name, field_name))
-	    return field;
-	else
-	    g_base_info_unref((GIBaseInfo *)field);
-    }
-    
-    return 0;
-}
-
-static GIFieldInfo * seed_struct_find_field(GIStructInfo * info,
-					   gchar * field_name)
-{
-    int n, i;
-    GIFieldInfo * field;
-    
-    n = g_struct_info_get_n_fields(info);
-    for (i = 0; i < n; i++)
-    {
-	const gchar * name;
-	
-	field = g_struct_info_get_field(info, i);
-	name = g_base_info_get_name((GIBaseInfo *) field);
-	if (!strcmp(name, field_name))
-	    return field;
-	else
-	    g_base_info_unref((GIBaseInfo *)field);
-    }
-    
-    return 0;
+	seed_struct_privates *priv =
+		(seed_struct_privates *) JSObjectGetPrivate(object);
+	GType type;
+	GIRegisteredTypeInfo *info =
+		(GIRegisteredTypeInfo *) g_base_info_get_type(priv->info);
+
+	type = g_registered_type_info_get_g_type(info);
+	g_base_info_unref((GIBaseInfo *) info);
+
+	g_boxed_free(type, priv->pointer);
+
+}
+
+static GIFieldInfo *seed_union_find_field(GIUnionInfo * info,
+										  gchar * field_name)
+{
+	int n, i;
+	GIFieldInfo *field;
+
+	n = g_union_info_get_n_fields(info);
+	for (i = 0; i < n; i++)
+	{
+		const gchar *name;
+
+		field = g_union_info_get_field(info, i);
+		name = g_base_info_get_name((GIBaseInfo *) field);
+		if (!strcmp(name, field_name))
+			return field;
+		else
+			g_base_info_unref((GIBaseInfo *) field);
+	}
+
+	return 0;
+}
+
+static GIFieldInfo *seed_struct_find_field(GIStructInfo * info,
+										   gchar * field_name)
+{
+	int n, i;
+	GIFieldInfo *field;
+
+	n = g_struct_info_get_n_fields(info);
+	for (i = 0; i < n; i++)
+	{
+		const gchar *name;
+
+		field = g_struct_info_get_field(info, i);
+		name = g_base_info_get_name((GIBaseInfo *) field);
+		if (!strcmp(name, field_name))
+			return field;
+		else
+			g_base_info_unref((GIBaseInfo *) field);
+	}
+
+	return 0;
 }
 
 static JSValueRef
 seed_union_get_property(JSContextRef context,
-			 JSObjectRef object,
-			 JSStringRef property_name,
-			 JSValueRef * exception)
-{
-    gpointer pointer;
-    gchar * cproperty_name;
-    int i;
-    int length;
-    seed_struct_privates * priv = JSObjectGetPrivate(object);
-    GIFieldInfo * field = 0;
-    GITypeInfo * field_type = 0;
-    GArgument field_value;
-    JSValueRef ret;
-
-    length = JSStringGetMaximumUTF8CStringSize(property_name);
-    cproperty_name = g_malloc(length * sizeof(gchar));
-    JSStringGetUTF8CString(property_name, cproperty_name, length);
-    
-    field = seed_union_find_field((GIUnionInfo *)priv->info,
-				  cproperty_name);
-    if (!field)
-    {
-	g_free(cproperty_name);
-	return 0;
-    }
-    
-    field_type = g_field_info_get_type(field);
-    if (!g_field_info_get_field(field, priv->pointer,
-				&field_value))
-    {
-	GITypeTag tag;
+						JSObjectRef object,
+						JSStringRef property_name, JSValueRef * exception)
+{
+	gpointer pointer;
+	gchar *cproperty_name;
+	int i;
+	int length;
+	seed_struct_privates *priv = JSObjectGetPrivate(object);
+	GIFieldInfo *field = 0;
+	GITypeInfo *field_type = 0;
+	GArgument field_value;
+	JSValueRef ret;
+
+	length = JSStringGetMaximumUTF8CStringSize(property_name);
+	cproperty_name = g_malloc(length * sizeof(gchar));
+	JSStringGetUTF8CString(property_name, cproperty_name, length);
 
-	tag = g_type_info_get_tag(field_type);
-	if (tag == GI_TYPE_TAG_INTERFACE)
+	field = seed_union_find_field((GIUnionInfo *) priv->info, cproperty_name);
+	if (!field)
 	{
-	    GIBaseInfo * interface;
+		g_free(cproperty_name);
+		return 0;
+	}
 
-	    interface = g_type_info_get_interface(field_type);
-	    gint offset = g_field_info_get_offset(field);
-	    switch (g_base_info_get_type(interface))
-	    {
-	    case GI_INFO_TYPE_STRUCT:
-		ret = seed_make_struct((priv->pointer + offset),
-				       interface);
-		goto found;
-	    case GI_INFO_TYPE_UNION:
-		ret = seed_make_union((priv->pointer + offset),
-				      interface);
-		goto found;
-	    case GI_INFO_TYPE_BOXED:
-		ret = seed_make_boxed((priv->pointer + offset),
-				      interface);
-		goto found;
-	    default:
-		g_base_info_unref(interface);
-	    }
+	field_type = g_field_info_get_type(field);
+	if (!g_field_info_get_field(field, priv->pointer, &field_value))
+	{
+		GITypeTag tag;
+
+		tag = g_type_info_get_tag(field_type);
+		if (tag == GI_TYPE_TAG_INTERFACE)
+		{
+			GIBaseInfo *interface;
+
+			interface = g_type_info_get_interface(field_type);
+			gint offset = g_field_info_get_offset(field);
+			switch (g_base_info_get_type(interface))
+			{
+			case GI_INFO_TYPE_STRUCT:
+				ret = seed_make_struct((priv->pointer + offset), interface);
+				goto found;
+			case GI_INFO_TYPE_UNION:
+				ret = seed_make_union((priv->pointer + offset), interface);
+				goto found;
+			case GI_INFO_TYPE_BOXED:
+				ret = seed_make_boxed((priv->pointer + offset), interface);
+				goto found;
+			default:
+				g_base_info_unref(interface);
+			}
+		}
+
+		g_free(cproperty_name);
+		return JSValueMakeNull(eng->context);
 	}
-	
+
+	// Maybe need to release argument.
+	ret = seed_gi_argument_make_js(&field_value, field_type, exception);
+
+ found:
+
+	g_base_info_unref((GIBaseInfo *) field);
+	if (field_type)
+		g_base_info_unref((GIBaseInfo *) field_type);
 	g_free(cproperty_name);
-	return JSValueMakeNull(eng->context);
-    }
-    
-    // Maybe need to release argument.
-    ret = seed_gi_argument_make_js(&field_value,
-				   field_type, exception);
-
-found:
-
-    g_base_info_unref((GIBaseInfo *) field);
-    if (field_type)
-	g_base_info_unref((GIBaseInfo *) field_type);
-    g_free(cproperty_name);    
-    
-    return ret;
-}
 
+	return ret;
+}
 
 static JSValueRef
 seed_struct_get_property(JSContextRef context,
-			 JSObjectRef object,
-			 JSStringRef property_name,
-			 JSValueRef * exception)
-{
-    gpointer pointer;
-    gchar * cproperty_name;
-    int i, n;
-    int length;
-    seed_struct_privates * priv = JSObjectGetPrivate(object);
-    GIFieldInfo * field = 0;
-    GITypeInfo * field_type = 0;
-    GArgument field_value;
-    JSValueRef ret;
-
-    length = JSStringGetMaximumUTF8CStringSize(property_name);
-    cproperty_name = g_malloc(length * sizeof(gchar));
-    JSStringGetUTF8CString(property_name, cproperty_name, length);
-
-    field = seed_struct_find_field((GIStructInfo *)priv->info,
-				   cproperty_name);
-    
-    if (!field)
-    {
-	g_free(cproperty_name);
-	return 0;
-    }
-    
-    field_type = g_field_info_get_type(field);
-    if (!g_field_info_get_field(field, priv->pointer,
-				&field_value))
-    {
-	GITypeTag tag;
+						 JSObjectRef object,
+						 JSStringRef property_name, JSValueRef * exception)
+{
+	gpointer pointer;
+	gchar *cproperty_name;
+	int i, n;
+	int length;
+	seed_struct_privates *priv = JSObjectGetPrivate(object);
+	GIFieldInfo *field = 0;
+	GITypeInfo *field_type = 0;
+	GArgument field_value;
+	JSValueRef ret;
+
+	length = JSStringGetMaximumUTF8CStringSize(property_name);
+	cproperty_name = g_malloc(length * sizeof(gchar));
+	JSStringGetUTF8CString(property_name, cproperty_name, length);
+
+	field = seed_struct_find_field((GIStructInfo *) priv->info, cproperty_name);
+
+	if (!field)
+	{
+		g_free(cproperty_name);
+		return 0;
+	}
 
-	tag = g_type_info_get_tag(field_type);
-	if (tag == GI_TYPE_TAG_INTERFACE)
+	field_type = g_field_info_get_type(field);
+	if (!g_field_info_get_field(field, priv->pointer, &field_value))
 	{
-	    GIBaseInfo * interface;
+		GITypeTag tag;
 
-	    interface = g_type_info_get_interface(field_type);
-	    gint offset = g_field_info_get_offset(field);
-	    switch (g_base_info_get_type(interface))
-	    {
-	    case GI_INFO_TYPE_STRUCT:
-		ret = seed_make_struct((priv->pointer + offset),
-				       interface);
-		goto found;
-	    case GI_INFO_TYPE_UNION:
-		ret = seed_make_union((priv->pointer + offset),
-				      interface);
-		goto found;
-	    case GI_INFO_TYPE_BOXED:
-		ret = seed_make_boxed((priv->pointer + offset),
-				      interface);
-		goto found;
-	    default:
-		g_base_info_unref(interface);
-	    }
+		tag = g_type_info_get_tag(field_type);
+		if (tag == GI_TYPE_TAG_INTERFACE)
+		{
+			GIBaseInfo *interface;
+
+			interface = g_type_info_get_interface(field_type);
+			gint offset = g_field_info_get_offset(field);
+			switch (g_base_info_get_type(interface))
+			{
+			case GI_INFO_TYPE_STRUCT:
+				ret = seed_make_struct((priv->pointer + offset), interface);
+				goto found;
+			case GI_INFO_TYPE_UNION:
+				ret = seed_make_union((priv->pointer + offset), interface);
+				goto found;
+			case GI_INFO_TYPE_BOXED:
+				ret = seed_make_boxed((priv->pointer + offset), interface);
+				goto found;
+			default:
+				g_base_info_unref(interface);
+			}
+		}
+
+		g_free(cproperty_name);
+		return JSValueMakeNull(eng->context);
 	}
-	
+
+	ret = seed_gi_argument_make_js(&field_value, field_type, exception);
+	// Maybe need to release argument
+ found:
+
+	g_base_info_unref((GIBaseInfo *) field);
+	if (field_type)
+		g_base_info_unref((GIBaseInfo *) field_type);
 	g_free(cproperty_name);
-	return JSValueMakeNull(eng->context);
-    }
-    
-    ret = seed_gi_argument_make_js(&field_value,
-				   field_type, exception);
-    // Maybe need to release argument
-found:
-    
-    g_base_info_unref((GIBaseInfo *) field);
-    if (field_type)
-	g_base_info_unref((GIBaseInfo *) field_type);
-    g_free(cproperty_name);    
-    
-    return ret;
+
+	return ret;
 }
 
 JSClassDefinition seed_pointer_def = {
-    0,				/* Version, always 0 */
-    0,
-    "seed_pointer",		/* Class Name */
-    NULL,			/* Parent Class */
-    NULL,			/* Static Values */
-    NULL,			/* Static Functions */
-    NULL,
-    seed_pointer_finalize,
-    NULL,			/* Has Property */
-    0,
-    NULL,			/* Set Property */
-    NULL,			/* Delete Property */
-    NULL,			/* Get Property Names */
-    NULL,			/* Call As Function */
-    NULL,			/* Call As Constructor */
-    NULL,			/* Has Instance */
-    NULL			/* Convert To Type */
+	0,							/* Version, always 0 */
+	0,
+	"seed_pointer",				/* Class Name */
+	NULL,						/* Parent Class */
+	NULL,						/* Static Values */
+	NULL,						/* Static Functions */
+	NULL,
+	seed_pointer_finalize,
+	NULL,						/* Has Property */
+	0,
+	NULL,						/* Set Property */
+	NULL,						/* Delete Property */
+	NULL,						/* Get Property Names */
+	NULL,						/* Call As Function */
+	NULL,						/* Call As Constructor */
+	NULL,						/* Has Instance */
+	NULL						/* Convert To Type */
 };
 
 JSClassDefinition seed_struct_def = {
-    0,				/* Version, always 0 */
-    0,
-    "seed_struct",		/* Class Name */
-    NULL,			/* Parent Class */
-    NULL,			/* Static Values */
-    NULL,			/* Static Functions */
-    NULL,
-    NULL, 
-    NULL,			/* Has Property */
-    seed_struct_get_property,
-    NULL,			/* Set Property */
-    NULL,			/* Delete Property */
-    NULL,			/* Get Property Names */
-    NULL,			/* Call As Function */
-    NULL,			/* Call As Constructor */
-    NULL,			/* Has Instance */
-    NULL			/* Convert To Type */
+	0,							/* Version, always 0 */
+	0,
+	"seed_struct",				/* Class Name */
+	NULL,						/* Parent Class */
+	NULL,						/* Static Values */
+	NULL,						/* Static Functions */
+	NULL,
+	NULL,
+	NULL,						/* Has Property */
+	seed_struct_get_property,
+	NULL,						/* Set Property */
+	NULL,						/* Delete Property */
+	NULL,						/* Get Property Names */
+	NULL,						/* Call As Function */
+	NULL,						/* Call As Constructor */
+	NULL,						/* Has Instance */
+	NULL						/* Convert To Type */
 };
 
 JSClassDefinition seed_union_def = {
-    0,				/* Version, always 0 */
-    0,
-    "seed_union",		/* Class Name */
-    NULL,			/* Parent Class */
-    NULL,			/* Static Values */
-    NULL,			/* Static Functions */
-    NULL,
-    NULL, 
-    NULL,			/* Has Property */
-    seed_union_get_property,
-    NULL,			/* Set Property */
-    NULL,			/* Delete Property */
-    NULL,			/* Get Property Names */
-    NULL,			/* Call As Function */
-    NULL,			/* Call As Constructor */
-    NULL,			/* Has Instance */
-    NULL			/* Convert To Type */
+	0,							/* Version, always 0 */
+	0,
+	"seed_union",				/* Class Name */
+	NULL,						/* Parent Class */
+	NULL,						/* Static Values */
+	NULL,						/* Static Functions */
+	NULL,
+	NULL,
+	NULL,						/* Has Property */
+	seed_union_get_property,
+	NULL,						/* Set Property */
+	NULL,						/* Delete Property */
+	NULL,						/* Get Property Names */
+	NULL,						/* Call As Function */
+	NULL,						/* Call As Constructor */
+	NULL,						/* Has Instance */
+	NULL						/* Convert To Type */
 };
 
 JSClassDefinition seed_boxed_def = {
-    0,				/* Version, always 0 */
-    0,
-    "seed_boxed",		/* Class Name */
-    NULL,			/* Parent Class */
-    NULL,			/* Static Values */
-    NULL,			/* Static Functions */
-    NULL,
-    seed_boxed_finalize,
-    NULL,			/* Has Property */
-    0,
-    NULL,			/* Set Property */
-    NULL,			/* Delete Property */
-    NULL,			/* Get Property Names */
-    NULL,			/* Call As Function */
-    NULL,			/* Call As Constructor */
-    NULL,			/* Has Instance */
-    NULL			/* Convert To Type */
+	0,							/* Version, always 0 */
+	0,
+	"seed_boxed",				/* Class Name */
+	NULL,						/* Parent Class */
+	NULL,						/* Static Values */
+	NULL,						/* Static Functions */
+	NULL,
+	seed_boxed_finalize,
+	NULL,						/* Has Property */
+	0,
+	NULL,						/* Set Property */
+	NULL,						/* Delete Property */
+	NULL,						/* Get Property Names */
+	NULL,						/* Call As Function */
+	NULL,						/* Call As Constructor */
+	NULL,						/* Has Instance */
+	NULL						/* Convert To Type */
 };
 
 gpointer seed_pointer_get_pointer(JSValueRef pointer)
 {
-    if (JSValueIsObjectOfClass(eng->context, pointer, seed_pointer_class))
-    {
-	seed_struct_privates * priv = 
-	    JSObjectGetPrivate((JSObjectRef)pointer);
-	return priv->pointer;
-    }
-    return 0;
+	if (JSValueIsObjectOfClass(eng->context, pointer, seed_pointer_class))
+	{
+		seed_struct_privates *priv = JSObjectGetPrivate((JSObjectRef) pointer);
+		return priv->pointer;
+	}
+	return 0;
 }
 
 JSObjectRef seed_make_pointer(gpointer pointer)
 {
-    seed_struct_privates * priv =
-	g_malloc(sizeof(seed_struct_privates));
-    priv->pointer = pointer;
-    priv->info = 0;
+	seed_struct_privates *priv = g_malloc(sizeof(seed_struct_privates));
+	priv->pointer = pointer;
+	priv->info = 0;
 
-    return JSObjectMake(eng->context, seed_pointer_class, priv);
+	return JSObjectMake(eng->context, seed_pointer_class, priv);
 }
 
 JSObjectRef seed_make_union(gpointer younion, GIBaseInfo * info)
 {
-    JSObjectRef object;
-    gint i, n_methods;
-    seed_struct_privates * priv = g_malloc(sizeof(seed_struct_privates));
-    
-    priv->pointer = younion;
-    priv->info = info;
-
-    object = JSObjectMake(eng->context, seed_union_class, priv);
-
-    if (info)
-    {
-	n_methods = g_union_info_get_n_methods((GIUnionInfo *) info);
-	for (i = 0; i < n_methods; i++)
-	{
-	    GIFunctionInfo *finfo;
+	JSObjectRef object;
+	gint i, n_methods;
+	seed_struct_privates *priv = g_malloc(sizeof(seed_struct_privates));
 
-	    finfo = g_union_info_get_method((GIUnionInfo *) info, i);
+	priv->pointer = younion;
+	priv->info = info;
 
-	    seed_gobject_define_property_from_function_info((GIFunctionInfo *)
-							    finfo, object,
-							    TRUE);
+	object = JSObjectMake(eng->context, seed_union_class, priv);
+
+	if (info)
+	{
+		n_methods = g_union_info_get_n_methods((GIUnionInfo *) info);
+		for (i = 0; i < n_methods; i++)
+		{
+			GIFunctionInfo *finfo;
+
+			finfo = g_union_info_get_method((GIUnionInfo *) info, i);
+
+			seed_gobject_define_property_from_function_info((GIFunctionInfo *)
+															finfo, object,
+															TRUE);
+		}
 	}
-    }
 
-    return object;
+	return object;
 }
 
 JSObjectRef seed_make_boxed(gpointer boxed, GIBaseInfo * info)
 {
-    JSObjectRef object;
-    gint i, n_methods;
-    seed_struct_privates * priv = g_malloc(sizeof(seed_struct_privates));
-    
-    priv->info = info;
-    priv->pointer = boxed;
+	JSObjectRef object;
+	gint i, n_methods;
+	seed_struct_privates *priv = g_malloc(sizeof(seed_struct_privates));
+
+	priv->info = info;
+	priv->pointer = boxed;
 
-    object = JSObjectMake(eng->context, seed_boxed_class, priv);
+	object = JSObjectMake(eng->context, seed_boxed_class, priv);
 
-    // FIXME: Instance methods?
+	// FIXME: Instance methods?
 
-    return object;
+	return object;
 }
 
 JSObjectRef seed_make_struct(gpointer strukt, GIBaseInfo * info)
 {
-    JSObjectRef object;
-    gint i, n_methods;
-    seed_struct_privates * priv = g_malloc(sizeof(seed_struct_privates));
-    
-    priv->info = info;
-    priv->pointer = strukt;
-
-    object = JSObjectMake(eng->context, seed_struct_class, priv);
-
-    if (info)
-    {
-	n_methods = g_struct_info_get_n_methods((GIStructInfo *) info);
-	for (i = 0; i < n_methods; i++)
-	{
-	    GIFunctionInfo *finfo;
+	JSObjectRef object;
+	gint i, n_methods;
+	seed_struct_privates *priv = g_malloc(sizeof(seed_struct_privates));
+
+	priv->info = info;
+	priv->pointer = strukt;
 
-	    finfo = g_struct_info_get_method((GIStructInfo *) info, i);
+	object = JSObjectMake(eng->context, seed_struct_class, priv);
 
-	    seed_gobject_define_property_from_function_info((GIFunctionInfo *)
-							    finfo, object,
-							    TRUE);
+	if (info)
+	{
+		n_methods = g_struct_info_get_n_methods((GIStructInfo *) info);
+		for (i = 0; i < n_methods; i++)
+		{
+			GIFunctionInfo *finfo;
+
+			finfo = g_struct_info_get_method((GIStructInfo *) info, i);
+
+			seed_gobject_define_property_from_function_info((GIFunctionInfo *)
+															finfo, object,
+															TRUE);
+		}
 	}
-    }
 
-    return object;
+	return object;
 }
 
 void seed_structs_init(void)
 {
-    seed_pointer_class = JSClassCreate(&seed_pointer_def);
-    seed_struct_def.parentClass = seed_pointer_class;
-    seed_struct_class = JSClassCreate(&seed_struct_def);
-    seed_union_def.parentClass = seed_union_class;
-    seed_union_class = JSClassCreate(&seed_union_def);
-    seed_boxed_def.parentClass = seed_struct_class;
-    seed_boxed_class = JSClassCreate(&seed_boxed_def);
+	seed_pointer_class = JSClassCreate(&seed_pointer_def);
+	seed_struct_def.parentClass = seed_pointer_class;
+	seed_struct_class = JSClassCreate(&seed_struct_def);
+	seed_union_def.parentClass = seed_union_class;
+	seed_union_class = JSClassCreate(&seed_union_def);
+	seed_boxed_def.parentClass = seed_struct_class;
+	seed_boxed_class = JSClassCreate(&seed_boxed_def);
 }

Modified: trunk/libseed/seed-structs.h
==============================================================================
--- trunk/libseed/seed-structs.h	(original)
+++ trunk/libseed/seed-structs.h	Sat Nov 22 19:00:31 2008
@@ -27,7 +27,6 @@
 JSObjectRef seed_make_struct(gpointer strukt, GIBaseInfo * info);
 JSObjectRef seed_make_boxed(gpointer boxed, GIBaseInfo * info);
 
-
 JSObjectRef seed_make_pointer(gpointer pointer);
 
 gpointer seed_pointer_get_pointer(JSValueRef strukt);

Modified: trunk/libseed/seed-types.c
==============================================================================
--- trunk/libseed/seed-types.c	(original)
+++ trunk/libseed/seed-types.c	Sat Nov 22 19:00:31 2008
@@ -31,1086 +31,1079 @@
 
 static gboolean seed_value_is_gobject(JSValueRef value)
 {
-    if (!JSValueIsObject(eng->context, value) ||
-	JSValueIsNull(eng->context, value))
-	return FALSE;
+	if (!JSValueIsObject(eng->context, value) ||
+		JSValueIsNull(eng->context, value))
+		return FALSE;
 
-    return JSValueIsObjectOfClass(eng->context, value, gobject_class);
+	return JSValueIsObjectOfClass(eng->context, value, gobject_class);
 }
 
 void seed_toggle_ref(gpointer data, GObject * object, gboolean is_last_ref)
 {
-    JSValueRef wrapper;
+	JSValueRef wrapper;
 
-    wrapper = (JSValueRef) data;
+	wrapper = (JSValueRef) data;
 
-    if (is_last_ref)
-    {
-	JSValueUnprotect(eng->context, wrapper);
-    }
-    else
-    {
-	JSValueProtect(eng->context, wrapper);
-    }
+	if (is_last_ref)
+	{
+		JSValueUnprotect(eng->context, wrapper);
+	}
+	else
+	{
+		JSValueProtect(eng->context, wrapper);
+	}
 }
 
 static void seed_gobject_destroyed(gpointer object)
 {
-    JSValueUnprotect(eng->context, (JSValueRef)object);
-    JSObjectSetPrivate((JSObjectRef)object, 0);
+	JSValueUnprotect(eng->context, (JSValueRef) object);
+	JSObjectSetPrivate((JSObjectRef) object, 0);
 }
 
 static JSValueRef seed_wrap_object(GObject * object)
 {
-    JSValueRef user_data;
-    JSValueRef js_ref;
-    JSClassRef class;
-    GType type, *interfaces;
-    JSValueRef prototype;
-    guint i, n;
-
-    type = G_OBJECT_TYPE(object);
+	JSValueRef user_data;
+	JSValueRef js_ref;
+	JSClassRef class;
+	GType type, *interfaces;
+	JSValueRef prototype;
+	guint i, n;
 
-    user_data = (JSValueRef) g_object_get_data(object, "js-ref");
+	type = G_OBJECT_TYPE(object);
 
-    if (user_data)
-	return user_data;
+	user_data = (JSValueRef) g_object_get_data(object, "js-ref");
 
-    class = seed_gobject_get_class_for_gtype(type);
+	if (user_data)
+		return user_data;
 
-    while (!class && (type = g_type_parent(type)))
-    {
 	class = seed_gobject_get_class_for_gtype(type);
-    }
 
-    prototype = seed_gobject_get_prototype_for_gtype(type);
-    js_ref = JSObjectMake(eng->context, class, object);
-    if (prototype)
-	JSObjectSetPrototype(eng->context, (JSObjectRef) js_ref, prototype);
-    else
-    {
-	g_assert_not_reached();
-    }
+	while (!class && (type = g_type_parent(type)))
+	{
+		class = seed_gobject_get_class_for_gtype(type);
+	}
 
-    g_object_set_data_full(object, "js-ref", (gpointer) js_ref, 
-			   seed_gobject_destroyed);
+	prototype = seed_gobject_get_prototype_for_gtype(type);
+	js_ref = JSObjectMake(eng->context, class, object);
+	if (prototype)
+		JSObjectSetPrototype(eng->context, (JSObjectRef) js_ref, prototype);
+	else
+	{
+		g_assert_not_reached();
+	}
 
-    JSValueProtect(eng->context, js_ref);
-    g_object_add_toggle_ref(object, seed_toggle_ref, (gpointer) js_ref);
+	g_object_set_data_full(object, "js-ref", (gpointer) js_ref,
+						   seed_gobject_destroyed);
 
-    return js_ref;
+	JSValueProtect(eng->context, js_ref);
+	g_object_add_toggle_ref(object, seed_toggle_ref, (gpointer) js_ref);
+
+	return js_ref;
 }
 
 static gboolean seed_release_arg(GITransfer transfer,
-				 GITypeInfo * type_info,
-				 GITypeTag type_tag,
-				 GArgument * arg)
-{
-    GType gtype;
-
-    switch (type_tag)
-    {
-    case GI_TYPE_TAG_UTF8:
-	g_free(arg->v_string);
-	break;
-    case GI_TYPE_TAG_INTERFACE:
-    {
-	if (arg->v_pointer)
-	{
-	    GIBaseInfo * interface_info;
-	    GType interface_type;
-	    
-	    interface_info = g_type_info_get_interface(type_info);
-	    
-	    gtype = 
-		g_registered_type_info_get_g_type(
-		    (GIRegisteredTypeInfo*)interface_info);
-	    
-	    if (g_type_is_a(gtype, G_TYPE_OBJECT) 
-		|| g_type_is_a(gtype, G_TYPE_INTERFACE))
-	    {
-		SEED_NOTE(MISC,
-			  "Unreffing object of type: %s in"
-			  "argument release. Reference count: %d\n",
-			  g_type_name(G_OBJECT_TYPE(G_OBJECT(arg->v_pointer))),
-			  G_OBJECT(arg->v_pointer)->ref_count);
-		g_object_unref(G_OBJECT(arg->v_pointer));
-	    }
-	    
-	    g_base_info_unref(interface_info);
-	}
-	break;
-    }
-    default:
-	break;
-
-    }
-    
-    return TRUE;
+								 GITypeInfo * type_info,
+								 GITypeTag type_tag, GArgument * arg)
+{
+	GType gtype;
+
+	switch (type_tag)
+	{
+	case GI_TYPE_TAG_UTF8:
+		g_free(arg->v_string);
+		break;
+	case GI_TYPE_TAG_INTERFACE:
+		{
+			if (arg->v_pointer)
+			{
+				GIBaseInfo *interface_info;
+				GType interface_type;
+
+				interface_info = g_type_info_get_interface(type_info);
+
+				gtype =
+					g_registered_type_info_get_g_type((GIRegisteredTypeInfo *)
+													  interface_info);
+
+				if (g_type_is_a(gtype, G_TYPE_OBJECT)
+					|| g_type_is_a(gtype, G_TYPE_INTERFACE))
+				{
+					SEED_NOTE(MISC,
+							  "Unreffing object of type: %s in"
+							  "argument release. Reference count: %d\n",
+							  g_type_name(G_OBJECT_TYPE
+										  (G_OBJECT(arg->v_pointer))),
+							  G_OBJECT(arg->v_pointer)->ref_count);
+					g_object_unref(G_OBJECT(arg->v_pointer));
+				}
+
+				g_base_info_unref(interface_info);
+			}
+			break;
+		}
+	default:
+		break;
+
+	}
+
+	return TRUE;
 }
 
 gboolean seed_gi_release_arg(GITransfer transfer,
-		    GITypeInfo *type_info,
-		    GArgument * arg)
+							 GITypeInfo * type_info, GArgument * arg)
 {
-    GITypeTag type_tag;
-    
-    if (transfer == GI_TRANSFER_NOTHING)
-	return TRUE;
-    
-    type_tag = g_type_info_get_tag ((GITypeInfo *) type_info);
-    
-    return seed_release_arg(transfer, 
-			    type_info,
-			    type_tag,
-			    arg);
+	GITypeTag type_tag;
+
+	if (transfer == GI_TRANSFER_NOTHING)
+		return TRUE;
+
+	type_tag = g_type_info_get_tag((GITypeInfo *) type_info);
+
+	return seed_release_arg(transfer, type_info, type_tag, arg);
 }
 
 gboolean seed_gi_release_in_arg(GITransfer transfer,
-				GITypeInfo * type_info,
-				GArgument * arg)
+								GITypeInfo * type_info, GArgument * arg)
 {
-    GITypeTag type_tag;
-    
-    if (transfer == GI_TRANSFER_EVERYTHING)
-	return;
-    
-    type_tag = g_type_info_get_tag ((GITypeInfo *) type_info);
-    
-    switch (type_tag)
-    {
-    case GI_TYPE_TAG_UTF8:
-	return seed_release_arg(GI_TRANSFER_EVERYTHING,
-			 type_info,
-			 type_tag,
-			 arg);
-    }
-    
-    return TRUE;
-}
+	GITypeTag type_tag;
 
+	if (transfer == GI_TRANSFER_EVERYTHING)
+		return;
+
+	type_tag = g_type_info_get_tag((GITypeInfo *) type_info);
+
+	switch (type_tag)
+	{
+	case GI_TYPE_TAG_UTF8:
+		return seed_release_arg(GI_TRANSFER_EVERYTHING,
+								type_info, type_tag, arg);
+	}
+
+	return TRUE;
+}
 
 gboolean
 seed_gi_make_argument(JSValueRef value,
-		      GITypeInfo * type_info, GArgument * arg,
-		      JSValueRef * exception)
+					  GITypeInfo * type_info, GArgument * arg,
+					  JSValueRef * exception)
 {
-    GITypeTag gi_tag = g_type_info_get_tag(type_info);
+	GITypeTag gi_tag = g_type_info_get_tag(type_info);
 
-    // FIXME: Some types are not "nullable", also need to check if argument
-    // can be null before doing this.
-    if (!value || JSValueIsNull(eng->context, value))
-    {
-	arg->v_pointer = 0;
-	return 1;
-    }
-
-    switch (gi_tag)
-    {
-    case GI_TYPE_TAG_VOID:
-	break;
-    case GI_TYPE_TAG_BOOLEAN:
-	arg->v_boolean = seed_value_to_boolean(value, exception);
-	break;
-    case GI_TYPE_TAG_INT8:
-	arg->v_int8 = seed_value_to_char(value, exception);
-	break;
-    case GI_TYPE_TAG_UINT8:
-	arg->v_uint8 = seed_value_to_uchar(value, exception);
-	break;
-    case GI_TYPE_TAG_INT16:
-	arg->v_int16 = seed_value_to_int(value, exception);
-	break;
-    case GI_TYPE_TAG_UINT16:
-	arg->v_uint16 = seed_value_to_uint(value, exception);
-	break;
-    case GI_TYPE_TAG_INT32:
-	arg->v_int32 = seed_value_to_int(value, exception);
-	break;
-    case GI_TYPE_TAG_UINT32:
-	arg->v_uint32 = seed_value_to_uint(value, exception);
-	break;
-    case GI_TYPE_TAG_LONG:
-    case GI_TYPE_TAG_INT64:
-	arg->v_int64 = seed_value_to_long(value, exception);
-	break;
-    case GI_TYPE_TAG_ULONG:
-    case GI_TYPE_TAG_UINT64:
-	arg->v_uint64 = seed_value_to_ulong(value, exception);
-	break;
-    case GI_TYPE_TAG_INT:
-	arg->v_int = seed_value_to_int(value, exception);
-	break;
-    case GI_TYPE_TAG_UINT:
-	arg->v_uint = seed_value_to_uint(value, exception);
-	break;
-    case GI_TYPE_TAG_SIZE:
-    case GI_TYPE_TAG_SSIZE:
-	arg->v_int = seed_value_to_int(value, exception);
-	break;
-    case GI_TYPE_TAG_FLOAT:
-	arg->v_float = seed_value_to_float(value, exception);
-	break;
-    case GI_TYPE_TAG_DOUBLE:
-	arg->v_double = seed_value_to_double(value, exception);
-	break;
-    case GI_TYPE_TAG_UTF8:
-	arg->v_string = seed_value_to_string(value, exception);
-	break;
-    case GI_TYPE_TAG_INTERFACE:
-	{
-	    GIBaseInfo *interface;
-	    GIInfoType interface_type;
-	    GType required_gtype;
-	    GObject *gobject;
-
-	    interface = g_type_info_get_interface(type_info);
-	    interface_type = g_base_info_get_type(interface);
-
-	    arg->v_pointer = NULL;
-
-	    if (interface_type == GI_INFO_TYPE_OBJECT
-		|| interface_type == GI_INFO_TYPE_INTERFACE)
-	    {
-		gobject = seed_value_to_object(value, exception);
-		required_gtype =
-		    g_registered_type_info_get_g_type((GIRegisteredTypeInfo *)
-						      interface);
-		
-		// FIXME: Not clear if the g_type_is_a check is desired here.
-		// Possibly 'breaks things' when we don't have introspection
-		// data for some things in an interface hierarchy. Hasn't
-		// provided any problems so far.
-		if (!gobject
-		    || !g_type_is_a(G_OBJECT_TYPE(gobject), required_gtype))
-		{
-		    g_base_info_unref(interface);
-		    return FALSE;
-		}
+	// FIXME: Some types are not "nullable", also need to check if argument
+	// can be null before doing this.
+	if (!value || JSValueIsNull(eng->context, value))
+	{
+		arg->v_pointer = 0;
+		return 1;
+	}
 
-		arg->v_pointer = gobject;
-		g_base_info_unref(interface);
+	switch (gi_tag)
+	{
+	case GI_TYPE_TAG_VOID:
 		break;
-	    }
-	    else if (interface_type == GI_INFO_TYPE_ENUM ||
-		     interface_type == GI_INFO_TYPE_FLAGS)
-	    {
-		arg->v_long = seed_value_to_long(value, exception);
-		g_base_info_unref(interface);
+	case GI_TYPE_TAG_BOOLEAN:
+		arg->v_boolean = seed_value_to_boolean(value, exception);
 		break;
-	    }
-	    else if (interface_type == GI_INFO_TYPE_STRUCT)
-	    {
-		if (JSValueIsObjectOfClass(eng->context,
-					   value, seed_struct_class))
-		    arg->v_pointer = seed_pointer_get_pointer(value);
-		else
-		{
-		    GType type =
-			g_registered_type_info_get_g_type((GIRegisteredTypeInfo
-							   *) interface);
-		    if (!type)
-		    {
-			g_base_info_unref(interface);
-			return FALSE;
-		    }
-		    // Automatically convert between functions and 
-		    // GClosures where expected.
-		    else if (g_type_is_a(type, G_TYPE_CLOSURE))
-		    {
-			if (JSObjectIsFunction
-			    (eng->context, (JSObjectRef) value))
-			{
-			    arg->v_pointer =
-				seed_make_gclosure((JSObjectRef) value, 0);
-			}
-		    }
-		}
-		g_base_info_unref(interface);
+	case GI_TYPE_TAG_INT8:
+		arg->v_int8 = seed_value_to_char(value, exception);
 		break;
-	    }
-	    else if (interface_type == GI_INFO_TYPE_CALLBACK)
-	    {
-		if (JSValueIsNull(eng->context, value))
-		{
-		    arg->v_pointer = NULL;
-		    g_base_info_unref(interface);
-		    break;
-		}
-		// Someone passes in a wrapper around a method where a 
-		// callback is expected, i.e Clutter.sine_inc_func, as an alpha
-		// Have to dlsym the symbol to be able to do this.
-		// NOTE: Some cases where dlsym(NULL, symbol) doesn't work depending
-		// On how libseed is loaded.
-		else if (JSValueIsObjectOfClass(eng->context,
-					   value, gobject_method_class))
-		{
-		    GIFunctionInfo *info =
-			JSObjectGetPrivate((JSObjectRef) value);
-		    const gchar *symbol = g_function_info_get_symbol(info);
-		    gchar *error;
-		    void *fp;
-
-		    dlerror();
-		    fp = (void *)dlsym(0, symbol);
-		    if ((error = dlerror()) != NULL)
-		    {
-			g_critical("dlerror: %s \n", error);
-		    }
-		    else
-		    {
-			arg->v_pointer = fp;
-			g_base_info_unref(interface);
-			break;
-		    }
-		}
-		// Somewhat deprecated from when it was necessary to manually
-		// create closure objects...
-		else if (JSValueIsObjectOfClass(eng->context,
-						value,
-						seed_native_callback_class))
-		{
-		    SeedNativeClosure *privates =
-			(SeedNativeClosure *)
-			JSObjectGetPrivate((JSObjectRef) value);
-		    arg->v_pointer = privates->closure;
-		    g_base_info_unref(interface);
-		    break;
-		}
-		// Automagically create closure around function passed in as 
-		// callback. 
-		else if (JSObjectIsFunction(eng->context, (JSObjectRef) value))
+	case GI_TYPE_TAG_UINT8:
+		arg->v_uint8 = seed_value_to_uchar(value, exception);
+		break;
+	case GI_TYPE_TAG_INT16:
+		arg->v_int16 = seed_value_to_int(value, exception);
+		break;
+	case GI_TYPE_TAG_UINT16:
+		arg->v_uint16 = seed_value_to_uint(value, exception);
+		break;
+	case GI_TYPE_TAG_INT32:
+		arg->v_int32 = seed_value_to_int(value, exception);
+		break;
+	case GI_TYPE_TAG_UINT32:
+		arg->v_uint32 = seed_value_to_uint(value, exception);
+		break;
+	case GI_TYPE_TAG_LONG:
+	case GI_TYPE_TAG_INT64:
+		arg->v_int64 = seed_value_to_long(value, exception);
+		break;
+	case GI_TYPE_TAG_ULONG:
+	case GI_TYPE_TAG_UINT64:
+		arg->v_uint64 = seed_value_to_ulong(value, exception);
+		break;
+	case GI_TYPE_TAG_INT:
+		arg->v_int = seed_value_to_int(value, exception);
+		break;
+	case GI_TYPE_TAG_UINT:
+		arg->v_uint = seed_value_to_uint(value, exception);
+		break;
+	case GI_TYPE_TAG_SIZE:
+	case GI_TYPE_TAG_SSIZE:
+		arg->v_int = seed_value_to_int(value, exception);
+		break;
+	case GI_TYPE_TAG_FLOAT:
+		arg->v_float = seed_value_to_float(value, exception);
+		break;
+	case GI_TYPE_TAG_DOUBLE:
+		arg->v_double = seed_value_to_double(value, exception);
+		break;
+	case GI_TYPE_TAG_UTF8:
+		arg->v_string = seed_value_to_string(value, exception);
+		break;
+	case GI_TYPE_TAG_INTERFACE:
 		{
-		    SeedNativeClosure *privates =
-			seed_make_native_closure((GICallableInfo *) interface,
-						 value);
-		    arg->v_pointer = privates->closure;
-		    break;
-		}
+			GIBaseInfo *interface;
+			GIInfoType interface_type;
+			GType required_gtype;
+			GObject *gobject;
 
-	    }
-	}
+			interface = g_type_info_get_interface(type_info);
+			interface_type = g_base_info_get_type(interface);
 
-    default:
-	return FALSE;
+			arg->v_pointer = NULL;
 
-    }
-    return TRUE;
+			if (interface_type == GI_INFO_TYPE_OBJECT
+				|| interface_type == GI_INFO_TYPE_INTERFACE)
+			{
+				gobject = seed_value_to_object(value, exception);
+				required_gtype =
+					g_registered_type_info_get_g_type((GIRegisteredTypeInfo *)
+													  interface);
+
+				// FIXME: Not clear if the g_type_is_a check is desired here.
+				// Possibly 'breaks things' when we don't have introspection
+				// data for some things in an interface hierarchy. Hasn't
+				// provided any problems so far.
+				if (!gobject
+					|| !g_type_is_a(G_OBJECT_TYPE(gobject), required_gtype))
+				{
+					g_base_info_unref(interface);
+					return FALSE;
+				}
+
+				arg->v_pointer = gobject;
+				g_base_info_unref(interface);
+				break;
+			}
+			else if (interface_type == GI_INFO_TYPE_ENUM ||
+					 interface_type == GI_INFO_TYPE_FLAGS)
+			{
+				arg->v_long = seed_value_to_long(value, exception);
+				g_base_info_unref(interface);
+				break;
+			}
+			else if (interface_type == GI_INFO_TYPE_STRUCT)
+			{
+				if (JSValueIsObjectOfClass(eng->context,
+										   value, seed_struct_class))
+					arg->v_pointer = seed_pointer_get_pointer(value);
+				else
+				{
+					GType type =
+						g_registered_type_info_get_g_type((GIRegisteredTypeInfo
+														   *) interface);
+					if (!type)
+					{
+						g_base_info_unref(interface);
+						return FALSE;
+					}
+					// Automatically convert between functions and 
+					// GClosures where expected.
+					else if (g_type_is_a(type, G_TYPE_CLOSURE))
+					{
+						if (JSObjectIsFunction
+							(eng->context, (JSObjectRef) value))
+						{
+							arg->v_pointer =
+								seed_make_gclosure((JSObjectRef) value, 0);
+						}
+					}
+				}
+				g_base_info_unref(interface);
+				break;
+			}
+			else if (interface_type == GI_INFO_TYPE_CALLBACK)
+			{
+				if (JSValueIsNull(eng->context, value))
+				{
+					arg->v_pointer = NULL;
+					g_base_info_unref(interface);
+					break;
+				}
+				// Someone passes in a wrapper around a method where a 
+				// callback is expected, i.e Clutter.sine_inc_func, as an alpha
+				// Have to dlsym the symbol to be able to do this.
+				// NOTE: Some cases where dlsym(NULL, symbol) doesn't work depending
+				// On how libseed is loaded.
+				else if (JSValueIsObjectOfClass(eng->context,
+												value, gobject_method_class))
+				{
+					GIFunctionInfo *info =
+						JSObjectGetPrivate((JSObjectRef) value);
+					const gchar *symbol = g_function_info_get_symbol(info);
+					gchar *error;
+					void *fp;
+
+					dlerror();
+					fp = (void *)dlsym(0, symbol);
+					if ((error = dlerror()) != NULL)
+					{
+						g_critical("dlerror: %s \n", error);
+					}
+					else
+					{
+						arg->v_pointer = fp;
+						g_base_info_unref(interface);
+						break;
+					}
+				}
+				// Somewhat deprecated from when it was necessary to manually
+				// create closure objects...
+				else if (JSValueIsObjectOfClass(eng->context,
+												value,
+												seed_native_callback_class))
+				{
+					SeedNativeClosure *privates =
+						(SeedNativeClosure *)
+						JSObjectGetPrivate((JSObjectRef) value);
+					arg->v_pointer = privates->closure;
+					g_base_info_unref(interface);
+					break;
+				}
+				// Automagically create closure around function passed in as 
+				// callback. 
+				else if (JSObjectIsFunction(eng->context, (JSObjectRef) value))
+				{
+					SeedNativeClosure *privates =
+						seed_make_native_closure((GICallableInfo *) interface,
+												 value);
+					arg->v_pointer = privates->closure;
+					break;
+				}
+
+			}
+		}
+
+	default:
+		return FALSE;
+
+	}
+	return TRUE;
 
 }
 
 JSValueRef
 seed_gi_argument_make_js(GArgument * arg, GITypeInfo * type_info,
-			 JSValueRef * exception)
+						 JSValueRef * exception)
 {
-    GITypeTag gi_tag = g_type_info_get_tag(type_info);
-    switch (gi_tag)
-    {
-    case GI_TYPE_TAG_VOID:
-	return 0;
-    case GI_TYPE_TAG_BOOLEAN:
-	return seed_value_from_boolean(arg->v_boolean, exception);
-    case GI_TYPE_TAG_INT8:
-	return seed_value_from_char(arg->v_int8, exception);
-    case GI_TYPE_TAG_UINT8:
-	return seed_value_from_uchar(arg->v_uint8, exception);
-    case GI_TYPE_TAG_INT16:
-	return seed_value_from_int(arg->v_int16, exception);
-    case GI_TYPE_TAG_UINT16:
-	return seed_value_from_uint(arg->v_uint16, exception);
-    case GI_TYPE_TAG_INT32:
-	return seed_value_from_int(arg->v_int32, exception);
-    case GI_TYPE_TAG_UINT32:
-	return seed_value_from_uint(arg->v_uint32, exception);
-    case GI_TYPE_TAG_LONG:
-    case GI_TYPE_TAG_INT64:
-	return seed_value_from_long(arg->v_int64, exception);
-    case GI_TYPE_TAG_ULONG:
-    case GI_TYPE_TAG_UINT64:
-	return seed_value_from_ulong(arg->v_uint64, exception);
-    case GI_TYPE_TAG_INT:
-	return seed_value_from_int(arg->v_int32, exception);
-    case GI_TYPE_TAG_UINT:
-	return seed_value_from_uint(arg->v_uint32, exception);
-    case GI_TYPE_TAG_SSIZE:
-    case GI_TYPE_TAG_SIZE:
-	return seed_value_from_int(arg->v_int, exception);
-    case GI_TYPE_TAG_FLOAT:
-	return seed_value_from_float(arg->v_float, exception);
-    case GI_TYPE_TAG_DOUBLE:
-	return seed_value_from_double(arg->v_double, exception);
-    case GI_TYPE_TAG_UTF8:
-	return seed_value_from_string(arg->v_string, exception);
-    case GI_TYPE_TAG_INTERFACE:
-	{
-	    GIBaseInfo *interface;
-	    GIInfoType interface_type;
-
-	    interface = g_type_info_get_interface(type_info);
-	    interface_type = g_base_info_get_type(interface);
-
-	    if (interface_type == GI_INFO_TYPE_OBJECT ||
-		interface_type == GI_INFO_TYPE_INTERFACE)
-	    {
-		if (arg->v_pointer == 0)
-		{
-		    g_base_info_unref(interface);
-		    return JSValueMakeNull(eng->context);
-		}
-		g_base_info_unref(interface);
-		return seed_value_from_object(arg->v_pointer, exception);
-	    }
-	    else if (interface_type == GI_INFO_TYPE_ENUM
-		     || interface_type == GI_INFO_TYPE_FLAGS)
-	    {
-		g_base_info_unref(interface);
+	GITypeTag gi_tag = g_type_info_get_tag(type_info);
+	switch (gi_tag)
+	{
+	case GI_TYPE_TAG_VOID:
+		return 0;
+	case GI_TYPE_TAG_BOOLEAN:
+		return seed_value_from_boolean(arg->v_boolean, exception);
+	case GI_TYPE_TAG_INT8:
+		return seed_value_from_char(arg->v_int8, exception);
+	case GI_TYPE_TAG_UINT8:
+		return seed_value_from_uchar(arg->v_uint8, exception);
+	case GI_TYPE_TAG_INT16:
+		return seed_value_from_int(arg->v_int16, exception);
+	case GI_TYPE_TAG_UINT16:
+		return seed_value_from_uint(arg->v_uint16, exception);
+	case GI_TYPE_TAG_INT32:
+		return seed_value_from_int(arg->v_int32, exception);
+	case GI_TYPE_TAG_UINT32:
+		return seed_value_from_uint(arg->v_uint32, exception);
+	case GI_TYPE_TAG_LONG:
+	case GI_TYPE_TAG_INT64:
+		return seed_value_from_long(arg->v_int64, exception);
+	case GI_TYPE_TAG_ULONG:
+	case GI_TYPE_TAG_UINT64:
+		return seed_value_from_ulong(arg->v_uint64, exception);
+	case GI_TYPE_TAG_INT:
+		return seed_value_from_int(arg->v_int32, exception);
+	case GI_TYPE_TAG_UINT:
+		return seed_value_from_uint(arg->v_uint32, exception);
+	case GI_TYPE_TAG_SSIZE:
+	case GI_TYPE_TAG_SIZE:
+		return seed_value_from_int(arg->v_int, exception);
+	case GI_TYPE_TAG_FLOAT:
+		return seed_value_from_float(arg->v_float, exception);
+	case GI_TYPE_TAG_DOUBLE:
 		return seed_value_from_double(arg->v_double, exception);
-	    }
-	    else if (interface_type == GI_INFO_TYPE_STRUCT)
-	    {
-		JSValueRef strukt;
-
-		strukt = seed_make_struct(arg->v_pointer, interface);
-		g_base_info_unref(interface);
-		
-		return strukt;
-	    }
-	}
-    case GI_TYPE_TAG_GLIST:
-	{
-	    GITypeInfo *list_type;
-	    JSObjectRef ret;
-	    GArgument larg;
-	    gint i = 0;
-	    GList *list = arg->v_pointer;
-
-	    ret = JSObjectMake(eng->context, NULL, NULL);
-	    list_type = g_type_info_get_param_type(type_info, 0);
-
-	    for (; list != NULL; list = list->next)
-	    {
-		JSValueRef ival;
-
-		larg.v_pointer = list->data;
-		ival =
-		    (JSValueRef) seed_gi_argument_make_js(&larg,
-							  list_type, exception);
-		JSObjectSetPropertyAtIndex(eng->context, ret, i, ival, NULL);
-		i++;
-	    }
-	    return ret;
-
-	}
-    case GI_TYPE_TAG_GSLIST:
-	{
-	    GITypeInfo *list_type;
-	    JSObjectRef ret;
-	    GArgument larg;
-	    gint i = 0;
-	    GSList *list = arg->v_pointer;
-
-	    ret = JSObjectMake(eng->context, NULL, NULL);
-	    list_type = g_type_info_get_param_type(type_info, 0);
-
-	    for (; list != NULL; list = list->next)
-	    {
-		JSValueRef ival;
-
-		larg.v_pointer = list->data;
-		ival =
-		    (JSValueRef) seed_gi_argument_make_js(&larg,
-							  list_type, exception);
-		JSObjectSetPropertyAtIndex(eng->context, ret, i, ival, NULL);
-		i++;
-	    }
-	    return ret;
-	}
+	case GI_TYPE_TAG_UTF8:
+		return seed_value_from_string(arg->v_string, exception);
+	case GI_TYPE_TAG_INTERFACE:
+		{
+			GIBaseInfo *interface;
+			GIInfoType interface_type;
 
-    default:
-	return FALSE;
+			interface = g_type_info_get_interface(type_info);
+			interface_type = g_base_info_get_type(interface);
 
-    }
-    return 0;
+			if (interface_type == GI_INFO_TYPE_OBJECT ||
+				interface_type == GI_INFO_TYPE_INTERFACE)
+			{
+				if (arg->v_pointer == 0)
+				{
+					g_base_info_unref(interface);
+					return JSValueMakeNull(eng->context);
+				}
+				g_base_info_unref(interface);
+				return seed_value_from_object(arg->v_pointer, exception);
+			}
+			else if (interface_type == GI_INFO_TYPE_ENUM
+					 || interface_type == GI_INFO_TYPE_FLAGS)
+			{
+				g_base_info_unref(interface);
+				return seed_value_from_double(arg->v_double, exception);
+			}
+			else if (interface_type == GI_INFO_TYPE_STRUCT)
+			{
+				JSValueRef strukt;
+
+				strukt = seed_make_struct(arg->v_pointer, interface);
+				g_base_info_unref(interface);
+
+				return strukt;
+			}
+		}
+	case GI_TYPE_TAG_GLIST:
+		{
+			GITypeInfo *list_type;
+			JSObjectRef ret;
+			GArgument larg;
+			gint i = 0;
+			GList *list = arg->v_pointer;
+
+			ret = JSObjectMake(eng->context, NULL, NULL);
+			list_type = g_type_info_get_param_type(type_info, 0);
+
+			for (; list != NULL; list = list->next)
+			{
+				JSValueRef ival;
+
+				larg.v_pointer = list->data;
+				ival =
+					(JSValueRef) seed_gi_argument_make_js(&larg,
+														  list_type, exception);
+				JSObjectSetPropertyAtIndex(eng->context, ret, i, ival, NULL);
+				i++;
+			}
+			return ret;
+
+		}
+	case GI_TYPE_TAG_GSLIST:
+		{
+			GITypeInfo *list_type;
+			JSObjectRef ret;
+			GArgument larg;
+			gint i = 0;
+			GSList *list = arg->v_pointer;
+
+			ret = JSObjectMake(eng->context, NULL, NULL);
+			list_type = g_type_info_get_param_type(type_info, 0);
+
+			for (; list != NULL; list = list->next)
+			{
+				JSValueRef ival;
+
+				larg.v_pointer = list->data;
+				ival =
+					(JSValueRef) seed_gi_argument_make_js(&larg,
+														  list_type, exception);
+				JSObjectSetPropertyAtIndex(eng->context, ret, i, ival, NULL);
+				i++;
+			}
+			return ret;
+		}
+
+	default:
+		return FALSE;
+
+	}
+	return 0;
 }
 
 JSValueRef seed_value_from_gvalue(GValue * gval, JSValueRef * exception)
 {
-    if (!G_IS_VALUE(gval))
-    {
-	return false;
-    }
-    switch (G_VALUE_TYPE(gval))
-    {
-    case G_TYPE_BOOLEAN:
-	return seed_value_from_boolean(g_value_get_boolean(gval), exception);
-    case G_TYPE_CHAR:
-	return seed_value_from_char(g_value_get_char(gval), exception);
-    case G_TYPE_UCHAR:
-	return seed_value_from_uchar(g_value_get_uchar(gval), exception);
-    case G_TYPE_INT:
-	return seed_value_from_int(g_value_get_int(gval), exception);
-    case G_TYPE_UINT:
-	return seed_value_from_uint(g_value_get_uint(gval), exception);
-    case G_TYPE_LONG:
-	return seed_value_from_long(g_value_get_long(gval), exception);
-    case G_TYPE_ULONG:
-	return seed_value_from_ulong(g_value_get_ulong(gval), exception);
-    case G_TYPE_INT64:
-	return seed_value_from_int64(g_value_get_int64(gval), exception);
-    case G_TYPE_UINT64:
-	return seed_value_from_uint64(g_value_get_uint64(gval), exception);
-    case G_TYPE_FLOAT:
-	return seed_value_from_float(g_value_get_float(gval), exception);
-    case G_TYPE_DOUBLE:
-	return seed_value_from_double(g_value_get_double(gval), exception);
-    case G_TYPE_STRING:
-	return seed_value_from_string((gchar *)
-				      g_value_get_string(gval), exception);
-    case G_TYPE_POINTER:
-	return seed_make_pointer(g_value_get_pointer(gval));
-    }
-
-    if (g_type_is_a(G_VALUE_TYPE(gval), G_TYPE_ENUM) ||
-	g_type_is_a(G_VALUE_TYPE(gval), G_TYPE_FLAGS))
-	return seed_value_from_long(gval->data[0].v_long, exception);
-    else if (g_type_is_a(G_VALUE_TYPE(gval), G_TYPE_ENUM))
-	return seed_value_from_long(gval->data[0].v_long, exception);
-    else if (g_type_is_a(G_VALUE_TYPE(gval), G_TYPE_OBJECT))
-    {
-	GObject * obj = g_value_get_object(gval);
-	return seed_value_from_object(obj, exception);
-    }
-    else
-    {
-	// This is very broken right now, struct rework coming soon...
-	GIBaseInfo *info;
-	GIInfoType type;
-
-	info = g_irepository_find_by_gtype(0, G_VALUE_TYPE(gval));
-	if (!info)
-	    return;
-	type = g_base_info_get_type(info);
-
-	if (type == GI_INFO_TYPE_UNION)
-	{
-	    return seed_make_union(g_value_peek_pointer(gval), info);
-	}
-	else if (type == GI_INFO_TYPE_STRUCT)
-	{
-	    return seed_make_struct(g_value_peek_pointer(gval), info);
-	}
-	else if (type == GI_INFO_TYPE_BOXED)
+	if (!G_IS_VALUE(gval))
 	{
-	    return seed_make_boxed(g_value_dup_boxed(gval), info);
+		return false;
 	}
+	switch (G_VALUE_TYPE(gval))
+	{
+	case G_TYPE_BOOLEAN:
+		return seed_value_from_boolean(g_value_get_boolean(gval), exception);
+	case G_TYPE_CHAR:
+		return seed_value_from_char(g_value_get_char(gval), exception);
+	case G_TYPE_UCHAR:
+		return seed_value_from_uchar(g_value_get_uchar(gval), exception);
+	case G_TYPE_INT:
+		return seed_value_from_int(g_value_get_int(gval), exception);
+	case G_TYPE_UINT:
+		return seed_value_from_uint(g_value_get_uint(gval), exception);
+	case G_TYPE_LONG:
+		return seed_value_from_long(g_value_get_long(gval), exception);
+	case G_TYPE_ULONG:
+		return seed_value_from_ulong(g_value_get_ulong(gval), exception);
+	case G_TYPE_INT64:
+		return seed_value_from_int64(g_value_get_int64(gval), exception);
+	case G_TYPE_UINT64:
+		return seed_value_from_uint64(g_value_get_uint64(gval), exception);
+	case G_TYPE_FLOAT:
+		return seed_value_from_float(g_value_get_float(gval), exception);
+	case G_TYPE_DOUBLE:
+		return seed_value_from_double(g_value_get_double(gval), exception);
+	case G_TYPE_STRING:
+		return seed_value_from_string((gchar *)
+									  g_value_get_string(gval), exception);
+	case G_TYPE_POINTER:
+		return seed_make_pointer(g_value_get_pointer(gval));
+	}
+
+	if (g_type_is_a(G_VALUE_TYPE(gval), G_TYPE_ENUM) ||
+		g_type_is_a(G_VALUE_TYPE(gval), G_TYPE_FLAGS))
+		return seed_value_from_long(gval->data[0].v_long, exception);
+	else if (g_type_is_a(G_VALUE_TYPE(gval), G_TYPE_ENUM))
+		return seed_value_from_long(gval->data[0].v_long, exception);
+	else if (g_type_is_a(G_VALUE_TYPE(gval), G_TYPE_OBJECT))
+	{
+		GObject *obj = g_value_get_object(gval);
+		return seed_value_from_object(obj, exception);
+	}
+	else
+	{
+		// This is very broken right now, struct rework coming soon...
+		GIBaseInfo *info;
+		GIInfoType type;
+
+		info = g_irepository_find_by_gtype(0, G_VALUE_TYPE(gval));
+		if (!info)
+			return;
+		type = g_base_info_get_type(info);
 
-    }
+		if (type == GI_INFO_TYPE_UNION)
+		{
+			return seed_make_union(g_value_peek_pointer(gval), info);
+		}
+		else if (type == GI_INFO_TYPE_STRUCT)
+		{
+			return seed_make_struct(g_value_peek_pointer(gval), info);
+		}
+		else if (type == GI_INFO_TYPE_BOXED)
+		{
+			return seed_make_boxed(g_value_dup_boxed(gval), info);
+		}
 
-    return NULL;
+	}
+
+	return NULL;
 }
 
 gboolean
 seed_gvalue_from_seed_value(JSValueRef val, GType type, GValue * ret,
-			    JSValueRef * exception)
+							JSValueRef * exception)
 {
-    switch (type)
-    {
-    case G_TYPE_BOOLEAN:
-	{
-	    g_value_init(ret, G_TYPE_BOOLEAN);
-	    g_value_set_boolean(ret, seed_value_to_boolean(val, exception));
-	    return TRUE;
-	}
-    case G_TYPE_INT:
-    case G_TYPE_UINT:
-	{
-	    g_value_init(ret, type);
-	    if (type == G_TYPE_INT)
-		g_value_set_int(ret, seed_value_to_int(val, exception));
-	    else
-		g_value_set_uint(ret, seed_value_to_uint(val, exception));
-	    return TRUE;
-	}
-    case G_TYPE_CHAR:
-	{
-	    g_value_init(ret, G_TYPE_CHAR);
-	    g_value_set_char(ret, seed_value_to_char(val, exception));
-	    return TRUE;
-	}
-    case G_TYPE_UCHAR:
-	{
-	    g_value_init(ret, G_TYPE_UCHAR);
-	    g_value_set_uchar(ret, seed_value_to_uchar(val, exception));
-	    return TRUE;
-	}
-    case G_TYPE_LONG:
-    case G_TYPE_ULONG:
-    case G_TYPE_INT64:
-    case G_TYPE_UINT64:
-    case G_TYPE_FLOAT:
-    case G_TYPE_DOUBLE:
-	{
-	    switch (type)
-	    {
-	    case G_TYPE_LONG:
-		g_value_init(ret, G_TYPE_LONG);
-		g_value_set_long(ret, seed_value_to_long(val, exception));
-		break;
-	    case G_TYPE_ULONG:
-		g_value_init(ret, G_TYPE_ULONG);
-		g_value_set_ulong(ret, seed_value_to_ulong(val, exception));
-		break;
-	    case G_TYPE_INT64:
-		g_value_init(ret, G_TYPE_INT64);
-		g_value_set_int64(ret, seed_value_to_int64(val, exception));
-		break;
-	    case G_TYPE_UINT64:
-		g_value_init(ret, G_TYPE_UINT64);
-		g_value_set_uint64(ret, seed_value_to_uint64(val, exception));
-		break;
-	    case G_TYPE_FLOAT:
-		g_value_init(ret, G_TYPE_FLOAT);
-		g_value_set_float(ret, seed_value_to_float(val, exception));
-		break;
-	    case G_TYPE_DOUBLE:
-		g_value_init(ret, G_TYPE_DOUBLE);
-		g_value_set_double(ret, seed_value_to_double(val, exception));
-		break;
-	    }
-	    return TRUE;
-	}
-    case G_TYPE_STRING:
+	switch (type)
 	{
-	    gchar *cval = seed_value_to_string(val, exception);
-
-	    g_value_init(ret, G_TYPE_STRING);
-	    g_value_take_string(ret, cval);
-
-	    return TRUE;
-	}
-    default:
-	{
-	    switch (JSValueGetType(eng->context, val))
-	    {
-	    case kJSTypeBoolean:
+	case G_TYPE_BOOLEAN:
+		{
+			g_value_init(ret, G_TYPE_BOOLEAN);
+			g_value_set_boolean(ret, seed_value_to_boolean(val, exception));
+			return TRUE;
+		}
+	case G_TYPE_INT:
+	case G_TYPE_UINT:
+		{
+			g_value_init(ret, type);
+			if (type == G_TYPE_INT)
+				g_value_set_int(ret, seed_value_to_int(val, exception));
+			else
+				g_value_set_uint(ret, seed_value_to_uint(val, exception));
+			return TRUE;
+		}
+	case G_TYPE_CHAR:
 		{
-		    g_value_init(ret, G_TYPE_BOOLEAN);
-		    g_value_set_boolean(ret,
-					seed_value_to_boolean(val, exception));
-		    return TRUE;
+			g_value_init(ret, G_TYPE_CHAR);
+			g_value_set_char(ret, seed_value_to_char(val, exception));
+			return TRUE;
 		}
-	    case kJSTypeNumber:
+	case G_TYPE_UCHAR:
 		{
-		    g_value_init(ret, G_TYPE_DOUBLE);
-		    g_value_set_double(ret,
-				       seed_value_to_double(val, exception));
-		    return TRUE;
+			g_value_init(ret, G_TYPE_UCHAR);
+			g_value_set_uchar(ret, seed_value_to_uchar(val, exception));
+			return TRUE;
+		}
+	case G_TYPE_LONG:
+	case G_TYPE_ULONG:
+	case G_TYPE_INT64:
+	case G_TYPE_UINT64:
+	case G_TYPE_FLOAT:
+	case G_TYPE_DOUBLE:
+		{
+			switch (type)
+			{
+			case G_TYPE_LONG:
+				g_value_init(ret, G_TYPE_LONG);
+				g_value_set_long(ret, seed_value_to_long(val, exception));
+				break;
+			case G_TYPE_ULONG:
+				g_value_init(ret, G_TYPE_ULONG);
+				g_value_set_ulong(ret, seed_value_to_ulong(val, exception));
+				break;
+			case G_TYPE_INT64:
+				g_value_init(ret, G_TYPE_INT64);
+				g_value_set_int64(ret, seed_value_to_int64(val, exception));
+				break;
+			case G_TYPE_UINT64:
+				g_value_init(ret, G_TYPE_UINT64);
+				g_value_set_uint64(ret, seed_value_to_uint64(val, exception));
+				break;
+			case G_TYPE_FLOAT:
+				g_value_init(ret, G_TYPE_FLOAT);
+				g_value_set_float(ret, seed_value_to_float(val, exception));
+				break;
+			case G_TYPE_DOUBLE:
+				g_value_init(ret, G_TYPE_DOUBLE);
+				g_value_set_double(ret, seed_value_to_double(val, exception));
+				break;
+			}
+			return TRUE;
 		}
-	    case kJSTypeString:
+	case G_TYPE_STRING:
 		{
-		    gchar *cv = seed_value_to_string(val,
-						     exception);
+			gchar *cval = seed_value_to_string(val, exception);
 
-		    g_value_init(ret, G_TYPE_STRING);
-		    g_value_take_string(ret, cv);
-		    return TRUE;
+			g_value_init(ret, G_TYPE_STRING);
+			g_value_take_string(ret, cval);
+
+			return TRUE;
+		}
+	default:
+		{
+			switch (JSValueGetType(eng->context, val))
+			{
+			case kJSTypeBoolean:
+				{
+					g_value_init(ret, G_TYPE_BOOLEAN);
+					g_value_set_boolean(ret,
+										seed_value_to_boolean(val, exception));
+					return TRUE;
+				}
+			case kJSTypeNumber:
+				{
+					g_value_init(ret, G_TYPE_DOUBLE);
+					g_value_set_double(ret,
+									   seed_value_to_double(val, exception));
+					return TRUE;
+				}
+			case kJSTypeString:
+				{
+					gchar *cv = seed_value_to_string(val,
+													 exception);
+
+					g_value_init(ret, G_TYPE_STRING);
+					g_value_take_string(ret, cv);
+					return TRUE;
+				}
+			default:
+				break;
+			}
+			break;
 		}
-	    default:
-		break;
-	    }
-	    break;
 	}
-    }
 
-    if (g_type_is_a(type, G_TYPE_ENUM) && JSValueIsNumber(eng->context, val))
-    {
-	g_value_init(ret, type);
-	ret->data[0].v_long = seed_value_to_long(val, exception);
-	return TRUE;
-    }
-    else if (g_type_is_a(type, G_TYPE_FLAGS)
-	     && JSValueIsNumber(eng->context, val))
-    {
-	g_value_init(ret, type);
-	ret->data[0].v_long = seed_value_to_long(val, exception);
-	return TRUE;
-    }
-    else if (g_type_is_a(type, G_TYPE_OBJECT)
-	     && (JSValueIsNull(eng->context, val)
-		 || seed_value_is_gobject(val)))
-    {
-	GObject *o = seed_value_to_object(val, exception);
-
-	if (o == NULL || g_type_is_a(G_OBJECT_TYPE(o), type))
-	{
-	    g_value_init(ret, G_TYPE_OBJECT);
-	    g_value_set_object(ret, o);
-
-	    return TRUE;
-	}
-    }
-    /* Boxed handling is broken. Will be fixed in struct overhall. */
-    else if (g_type_is_a(type, G_TYPE_BOXED))
-    {
-	gpointer p = seed_pointer_get_pointer(val);
-	if (p)
-	{
-	    g_value_init(ret, type);
-	    g_value_set_boxed(ret, p);
-	    return TRUE;
+	if (g_type_is_a(type, G_TYPE_ENUM) && JSValueIsNumber(eng->context, val))
+	{
+		g_value_init(ret, type);
+		ret->data[0].v_long = seed_value_to_long(val, exception);
+		return TRUE;
+	}
+	else if (g_type_is_a(type, G_TYPE_FLAGS)
+			 && JSValueIsNumber(eng->context, val))
+	{
+		g_value_init(ret, type);
+		ret->data[0].v_long = seed_value_to_long(val, exception);
+		return TRUE;
 	}
-    }
+	else if (g_type_is_a(type, G_TYPE_OBJECT)
+			 && (JSValueIsNull(eng->context, val)
+				 || seed_value_is_gobject(val)))
+	{
+		GObject *o = seed_value_to_object(val, exception);
+
+		if (o == NULL || g_type_is_a(G_OBJECT_TYPE(o), type))
+		{
+			g_value_init(ret, G_TYPE_OBJECT);
+			g_value_set_object(ret, o);
 
-    return FALSE;
+			return TRUE;
+		}
+	}
+	/* Boxed handling is broken. Will be fixed in struct overhall. */
+	else if (g_type_is_a(type, G_TYPE_BOXED))
+	{
+		gpointer p = seed_pointer_get_pointer(val);
+		if (p)
+		{
+			g_value_init(ret, type);
+			g_value_set_boxed(ret, p);
+			return TRUE;
+		}
+	}
+
+	return FALSE;
 }
 
 JSValueRef seed_object_get_property(JSObjectRef val, const gchar * name)
 {
 
-    JSStringRef jname = JSStringCreateWithUTF8CString(name);
-    JSValueRef ret = JSObjectGetProperty(eng->context,
-					 (JSObjectRef) val,
-					 jname, NULL);
+	JSStringRef jname = JSStringCreateWithUTF8CString(name);
+	JSValueRef ret = JSObjectGetProperty(eng->context,
+										 (JSObjectRef) val,
+										 jname, NULL);
 
-    JSStringRelease(jname);
+	JSStringRelease(jname);
 
-    return ret;
+	return ret;
 }
 
 gboolean
 seed_object_set_property(JSObjectRef object,
-			const gchar * name, JSValueRef value)
+						 const gchar * name, JSValueRef value)
 {
-    JSStringRef jname = JSStringCreateWithUTF8CString(name);
+	JSStringRef jname = JSStringCreateWithUTF8CString(name);
 
-    if (value)
-    {
-	JSObjectSetProperty(eng->context, (JSObjectRef) object,
-			    jname, value, 0, 0);
-    }
+	if (value)
+	{
+		JSObjectSetProperty(eng->context, (JSObjectRef) object,
+							jname, value, 0, 0);
+	}
 
-    JSStringRelease(jname);
+	JSStringRelease(jname);
 
-    return TRUE;
+	return TRUE;
 }
 
 /* TODO: Make some macros or something for making exceptions, code is littered
    with annoyingness right now */
 gboolean seed_value_to_boolean(JSValueRef val, JSValueRef * exception)
 {
-    if (!JSValueIsBoolean(eng->context, val))
-    {
-	if (!JSValueIsNull(eng->context, val))
-	{
-	    seed_make_exception(exception, "ConversionError",
-				"Can not convert Javascript value to boolean");
-	    return 0;
-	}
+	if (!JSValueIsBoolean(eng->context, val))
+	{
+		if (!JSValueIsNull(eng->context, val))
+		{
+			seed_make_exception(exception, "ConversionError",
+								"Can not convert Javascript value to boolean");
+			return 0;
+		}
 
-	return 0;
-    }
+		return 0;
+	}
 
-    return JSValueToBoolean(eng->context, val);
+	return JSValueToBoolean(eng->context, val);
 }
 
 JSValueRef seed_value_from_boolean(gboolean val, JSValueRef * exception)
 {
-    return JSValueMakeBoolean(eng->context, val);
+	return JSValueMakeBoolean(eng->context, val);
 }
 
 guint seed_value_to_uint(JSValueRef val, JSValueRef * exception)
 {
-    if (!JSValueIsNumber(eng->context, val))
-    {
-	if (!JSValueIsNull(eng->context, val))
-	{
-	    seed_make_exception(exception, "ConversionError",
-				"Can not convert Javascript value to"
-				" boolean");
+	if (!JSValueIsNumber(eng->context, val))
+	{
+		if (!JSValueIsNull(eng->context, val))
+		{
+			seed_make_exception(exception, "ConversionError",
+								"Can not convert Javascript value to"
+								" boolean");
+		}
+		return 0;
 	}
-	return 0;
-    }
 
-    return (guint) JSValueToNumber(eng->context, val, NULL);
+	return (guint) JSValueToNumber(eng->context, val, NULL);
 }
 
 JSValueRef seed_value_from_uint(guint val, JSValueRef * exception)
 {
-    return JSValueMakeNumber(eng->context, (gdouble) val);
+	return JSValueMakeNumber(eng->context, (gdouble) val);
 }
 
 gint seed_value_to_int(JSValueRef val, JSValueRef * exception)
 {
-    if (!JSValueIsNumber(eng->context, val))
-    {
-	if (!JSValueIsNull(eng->context, val))
-	    seed_make_exception(exception, "ConversionError",
-				"Can not convert Javascript value to" " int");
-	return 0;
-    }
+	if (!JSValueIsNumber(eng->context, val))
+	{
+		if (!JSValueIsNull(eng->context, val))
+			seed_make_exception(exception, "ConversionError",
+								"Can not convert Javascript value to" " int");
+		return 0;
+	}
 
-    return (gint) JSValueToNumber(eng->context, val, NULL);
+	return (gint) JSValueToNumber(eng->context, val, NULL);
 }
 
 JSValueRef seed_value_from_int(gint val, JSValueRef * exception)
 {
-    return JSValueMakeNumber(eng->context, (gdouble) val);
+	return JSValueMakeNumber(eng->context, (gdouble) val);
 }
 
 gchar seed_value_to_char(JSValueRef val, JSValueRef * exception)
 {
-    gint cv;
+	gint cv;
 
-    if (!JSValueIsNumber(eng->context, val))
-    {
-	if (!JSValueIsNull(eng->context, val))
-	    seed_make_exception(exception, "ConversionError",
-				"Can not convert Javascript value to" " gchar");
-	return 0;
-    }
+	if (!JSValueIsNumber(eng->context, val))
+	{
+		if (!JSValueIsNull(eng->context, val))
+			seed_make_exception(exception, "ConversionError",
+								"Can not convert Javascript value to" " gchar");
+		return 0;
+	}
 
-    cv = JSValueToNumber(eng->context, val, NULL);
+	cv = JSValueToNumber(eng->context, val, NULL);
 
-    if (cv < G_MININT8 || cv > G_MAXINT8)
-    {
-	seed_make_exception(exception, "ConversionError",
-			    "Javascript number out of range of gchar");
-	return 0;
-    }
+	if (cv < G_MININT8 || cv > G_MAXINT8)
+	{
+		seed_make_exception(exception, "ConversionError",
+							"Javascript number out of range of gchar");
+		return 0;
+	}
 
-    return (char)cv;
+	return (char)cv;
 }
 
 JSValueRef seed_value_from_char(gchar val, JSValueRef * exception)
 {
-    return JSValueMakeNumber(eng->context, (gdouble) val);
+	return JSValueMakeNumber(eng->context, (gdouble) val);
 }
 
 guchar seed_value_to_uchar(JSValueRef val, JSValueRef * exception)
 {
-    guint cv;
+	guint cv;
 
-    if (!JSValueIsNumber(eng->context, val))
-    {
-	if (!JSValueIsNull(eng->context, val))
-	    seed_make_exception(exception, "ConversionError",
-				"Can not convert Javascript value to"
-				" guchar");
-	return 0;
-    }
+	if (!JSValueIsNumber(eng->context, val))
+	{
+		if (!JSValueIsNull(eng->context, val))
+			seed_make_exception(exception, "ConversionError",
+								"Can not convert Javascript value to"
+								" guchar");
+		return 0;
+	}
 
-    cv = JSValueToNumber(eng->context, val, NULL);
+	cv = JSValueToNumber(eng->context, val, NULL);
 
-    if (cv > G_MAXUINT8)
-    {
-	seed_make_exception(exception, "ConversionError",
-			    "Javascript number out of range of guchar");
-	return 0;
-    }
+	if (cv > G_MAXUINT8)
+	{
+		seed_make_exception(exception, "ConversionError",
+							"Javascript number out of range of guchar");
+		return 0;
+	}
 
-    return (guchar) cv;
+	return (guchar) cv;
 }
 
 JSValueRef seed_value_from_uchar(guchar val, JSValueRef * exception)
 {
-    return JSValueMakeNumber(eng->context, (gdouble) val);
+	return JSValueMakeNumber(eng->context, (gdouble) val);
 }
 
 glong seed_value_to_long(JSValueRef val, JSValueRef * exception)
 {
-    if (!JSValueIsNumber(eng->context, val))
-    {
-	if (!JSValueIsNull(eng->context, val))
-	    seed_make_exception(exception, "ConversionError",
-				"Can not convert Javascript value to" " long");
-	return 0;
-    }
+	if (!JSValueIsNumber(eng->context, val))
+	{
+		if (!JSValueIsNull(eng->context, val))
+			seed_make_exception(exception, "ConversionError",
+								"Can not convert Javascript value to" " long");
+		return 0;
+	}
 
-    return (glong) JSValueToNumber(eng->context, val, NULL);
+	return (glong) JSValueToNumber(eng->context, val, NULL);
 }
 
 JSValueRef seed_value_from_long(glong val, JSValueRef * exception)
 {
-    return JSValueMakeNumber(eng->context, (gdouble) val);
+	return JSValueMakeNumber(eng->context, (gdouble) val);
 }
 
 gulong seed_value_to_ulong(JSValueRef val, JSValueRef * exception)
 {
-    if (!JSValueIsNumber(eng->context, val))
-    {
-	if (!JSValueIsNull(eng->context, val))
-	    seed_make_exception(exception, "ConversionError",
-				"Can not convert Javascript value to" " ulong");
+	if (!JSValueIsNumber(eng->context, val))
+	{
+		if (!JSValueIsNull(eng->context, val))
+			seed_make_exception(exception, "ConversionError",
+								"Can not convert Javascript value to" " ulong");
 
-	return 0;
-    }
+		return 0;
+	}
 
-    return (gulong) JSValueToNumber(eng->context, val, NULL);
+	return (gulong) JSValueToNumber(eng->context, val, NULL);
 }
 
 JSValueRef seed_value_from_ulong(gulong val, JSValueRef * exception)
 {
-    return JSValueMakeNumber(eng->context, (gdouble) val);
+	return JSValueMakeNumber(eng->context, (gdouble) val);
 }
 
 gint64 seed_value_to_int64(JSValueRef val, JSValueRef * exception)
 {
-    if (!JSValueIsNumber(eng->context, val))
-    {
-	if (!JSValueIsNull(eng->context, val))
-	    seed_make_exception(exception, "ConversionError",
-				"Can not convert Javascript value to"
-				" gint64");
+	if (!JSValueIsNumber(eng->context, val))
+	{
+		if (!JSValueIsNull(eng->context, val))
+			seed_make_exception(exception, "ConversionError",
+								"Can not convert Javascript value to"
+								" gint64");
 
-	return 0;
-    }
+		return 0;
+	}
 
-    return (gint64) JSValueToNumber(eng->context, val, NULL);
+	return (gint64) JSValueToNumber(eng->context, val, NULL);
 }
 
 JSValueRef seed_value_from_int64(gint64 val, JSValueRef * exception)
 {
-    return JSValueMakeNumber(eng->context, (gdouble) val);
+	return JSValueMakeNumber(eng->context, (gdouble) val);
 }
 
 guint64 seed_value_to_uint64(JSValueRef val, JSValueRef * exception)
 {
-    if (!JSValueIsNumber(eng->context, val))
-    {
-	if (!JSValueIsNull(eng->context, val))
-	    seed_make_exception(exception, "ConversionError",
-				"Can not convert Javascript value to"
-				" guint64");
+	if (!JSValueIsNumber(eng->context, val))
+	{
+		if (!JSValueIsNull(eng->context, val))
+			seed_make_exception(exception, "ConversionError",
+								"Can not convert Javascript value to"
+								" guint64");
 
-	return 0;
-    }
+		return 0;
+	}
 
-    return (guint64) JSValueToNumber(eng->context, val, NULL);
+	return (guint64) JSValueToNumber(eng->context, val, NULL);
 }
 
 JSValueRef seed_value_from_uint64(guint64 val, JSValueRef * exception)
 {
-    return JSValueMakeNumber(eng->context, (gdouble) val);
+	return JSValueMakeNumber(eng->context, (gdouble) val);
 }
 
 gfloat seed_value_to_float(JSValueRef val, JSValueRef * exception)
 {
-    if (!JSValueIsNumber(eng->context, val))
-    {
-	if (!JSValueIsNull(eng->context, val))
-	    seed_make_exception(exception, "ConversionError",
-				"Can not convert Javascript value to"
-				" gfloat");
-	return 0;
-    }
+	if (!JSValueIsNumber(eng->context, val))
+	{
+		if (!JSValueIsNull(eng->context, val))
+			seed_make_exception(exception, "ConversionError",
+								"Can not convert Javascript value to"
+								" gfloat");
+		return 0;
+	}
 
-    return (gfloat) JSValueToNumber(eng->context, val, NULL);
+	return (gfloat) JSValueToNumber(eng->context, val, NULL);
 }
 
 JSValueRef seed_value_from_float(gfloat val, JSValueRef * exception)
 {
-    return JSValueMakeNumber(eng->context, (gdouble) val);
+	return JSValueMakeNumber(eng->context, (gdouble) val);
 }
 
 gdouble seed_value_to_double(JSValueRef val, JSValueRef * exception)
 {
-    if (!JSValueIsNumber(eng->context, val))
-    {
-	if (!JSValueIsNull(eng->context, val))
-	    seed_make_exception(exception, "ConversionError",
-				"Can not convert Javascript value to"
-				" double");
-	return 0;
-    }
+	if (!JSValueIsNumber(eng->context, val))
+	{
+		if (!JSValueIsNull(eng->context, val))
+			seed_make_exception(exception, "ConversionError",
+								"Can not convert Javascript value to"
+								" double");
+		return 0;
+	}
 
-    return (gdouble) JSValueToNumber(eng->context, val, NULL);
+	return (gdouble) JSValueToNumber(eng->context, val, NULL);
 }
 
 JSValueRef seed_value_from_double(gdouble val, JSValueRef * exception)
 {
-    return JSValueMakeNumber(eng->context, (gdouble) val);
+	return JSValueMakeNumber(eng->context, (gdouble) val);
 }
 
 gchar *seed_value_to_string(JSValueRef val, JSValueRef * exception)
 {
-    JSStringRef jsstr = 0;
-    JSValueRef func, str;
-    gchar *buf = 0;
-    gint length;
+	JSStringRef jsstr = 0;
+	JSValueRef func, str;
+	gchar *buf = 0;
+	gint length;
 
-    if (val == NULL)
-	return NULL;
+	if (val == NULL)
+		return NULL;
+
+	if (JSValueIsBoolean(eng->context, val)
+		|| JSValueIsNumber(eng->context, val))
+	{
+		buf = g_strdup_printf("%f", JSValueToNumber(eng->context, val, NULL));
+	}
+	else if (JSValueIsNull(eng->context, val)
+			 || JSValueIsUndefined(eng->context, val))
+	{
+		buf = strdup("[null]");
+	}
+	else
+	{
+		if (!JSValueIsString(eng->context, val))	// In this case,
+			// it's an object
+		{
+			func = seed_object_get_property((JSObjectRef) val, "toString");
+			str =
+				JSObjectCallAsFunction(eng->context,
+									   (JSObjectRef) func,
+									   (JSObjectRef) val, 0, NULL, NULL);
+		}
 
-    if (JSValueIsBoolean(eng->context, val)
-	|| JSValueIsNumber(eng->context, val))
-    {
-	buf = g_strdup_printf("%f", JSValueToNumber(eng->context, val, NULL));
-    }
-    else if (JSValueIsNull(eng->context, val)
-	     || JSValueIsUndefined(eng->context, val))
-    {
-	buf = strdup("[null]");
-    }
-    else
-    {
-	if (!JSValueIsString(eng->context, val))	// In this case,
-	    // it's an object
-	{
-	    func = seed_object_get_property((JSObjectRef)val, "toString");
-	    str =
-		JSObjectCallAsFunction(eng->context,
-				       (JSObjectRef) func,
-				       (JSObjectRef) val, 0, NULL, NULL);
-	}
-
-	jsstr = JSValueToStringCopy(eng->context, val, NULL);
-	length = JSStringGetMaximumUTF8CStringSize(jsstr);
-	if (length > 0)
-	{
-	    buf = g_malloc(length * sizeof(gchar));
-	    JSStringGetUTF8CString(jsstr, buf, length);
-	}
-	if (jsstr)
-	    JSStringRelease(jsstr);
-    }
+		jsstr = JSValueToStringCopy(eng->context, val, NULL);
+		length = JSStringGetMaximumUTF8CStringSize(jsstr);
+		if (length > 0)
+		{
+			buf = g_malloc(length * sizeof(gchar));
+			JSStringGetUTF8CString(jsstr, buf, length);
+		}
+		if (jsstr)
+			JSStringRelease(jsstr);
+	}
 
-    return buf;
+	return buf;
 }
 
 JSValueRef seed_value_from_string(const gchar * val, JSValueRef * exception)
 {
-    JSStringRef jsstr = JSStringCreateWithUTF8CString(val);
-    JSValueRef valstr = JSValueMakeString(eng->context, jsstr);
-    JSStringRelease(jsstr);
+	JSStringRef jsstr = JSStringCreateWithUTF8CString(val);
+	JSValueRef valstr = JSValueMakeString(eng->context, jsstr);
+	JSStringRelease(jsstr);
 
-    return valstr;
+	return valstr;
 }
 
 GObject *seed_value_to_object(JSValueRef val, JSValueRef * exception)
 {
-    GObject *gobject;
-    
-    /* Worth investigating if this is the best way to handle null. Some of 
-      the existing code depends on null Objects not throwing an exception however.
-      needs testing at higher level if value can be null (through GI) */
-    if (JSValueIsNull(eng->context, val))
-	return 0;
-    if (!seed_value_is_gobject(val))
-    {
-	seed_make_exception(exception, "ConversionError", "Attempt to convert from"
-			    " non GObject to GObject");
-	return NULL;
-    }
+	GObject *gobject;
+
+	/* Worth investigating if this is the best way to handle null. Some of 
+	   the existing code depends on null Objects not throwing an exception however.
+	   needs testing at higher level if value can be null (through GI) */
+	if (JSValueIsNull(eng->context, val))
+		return 0;
+	if (!seed_value_is_gobject(val))
+	{
+		seed_make_exception(exception, "ConversionError",
+							"Attempt to convert from"
+							" non GObject to GObject");
+		return NULL;
+	}
 
-    gobject = (GObject *) JSObjectGetPrivate((JSObjectRef) val);
+	gobject = (GObject *) JSObjectGetPrivate((JSObjectRef) val);
 
-    return gobject;
+	return gobject;
 }
 
 JSValueRef seed_value_from_object(GObject * val, JSValueRef * exception)
 {
-    if (val == NULL)
-	return JSValueMakeNull(eng->context);
-    else
-	return seed_wrap_object(val);
+	if (val == NULL)
+		return JSValueMakeNull(eng->context);
+	else
+		return seed_wrap_object(val);
 }

Modified: trunk/libseed/seed-types.h
==============================================================================
--- trunk/libseed/seed-types.h	(original)
+++ trunk/libseed/seed-types.h	Sat Nov 22 19:00:31 2008
@@ -28,23 +28,21 @@
 JSValueRef seed_object_get_property(JSObjectRef val, const gchar * name);
 
 gboolean seed_object_set_property(JSObjectRef object,
-				 const gchar * name, JSValueRef value);
+								  const gchar * name, JSValueRef value);
 gboolean seed_gvalue_from_seed_value(JSValueRef val, GType type,
-				     GValue * gval, JSValueRef * exception);
+									 GValue * gval, JSValueRef * exception);
 gboolean seed_gi_make_argument(JSValueRef value,
-			       GITypeInfo * type_info,
-			       GArgument * arg, JSValueRef * exception);
+							   GITypeInfo * type_info,
+							   GArgument * arg, JSValueRef * exception);
 JSValueRef seed_gi_argument_make_js(GArgument * arg,
-				    GITypeInfo * type_info,
-				    JSValueRef * exception);
+									GITypeInfo * type_info,
+									JSValueRef * exception);
 
 gboolean seed_gi_release_arg(GITransfer transfer,
-				GITypeInfo * type_info,
-			     GArgument * arg);
+							 GITypeInfo * type_info, GArgument * arg);
 
 gboolean seed_gi_release_in_arg(GITransfer transfer,
-				GITypeInfo * type_info,
-				GArgument * arg);
+								GITypeInfo * type_info, GArgument * arg);
 
 gboolean seed_value_to_boolean(JSValueRef val, JSValueRef * exception);
 JSValueRef seed_value_from_boolean(gboolean val, JSValueRef * exception);

Modified: trunk/libseed/seed.h
==============================================================================
--- trunk/libseed/seed.h	(original)
+++ trunk/libseed/seed.h	Sat Nov 22 19:00:31 2008
@@ -37,7 +37,7 @@
 gboolean seed_init(gint * argc, gchar *** argv);
 
 SeedScript *seed_make_script(const gchar * s, const gchar * source_url,
-			     gint line_number);
+							 gint line_number);
 SeedException seed_script_exception(SeedScript * s);
 SeedException seed_make_exception(gchar * name, gchar * message);
 gchar *seed_exception_get_name(SeedException e);
@@ -92,13 +92,13 @@
 SeedValue seed_value_from_object(GObject * val, SeedException * exception);
 
 typedef void (*SeedFunctionCallback) (SeedContextRef ctx,
-				      SeedObject function,
-				      SeedObject this_object,
-				      size_t argument_count,
-				      const SeedValue arguments[],
-				      SeedException * exception);
+									  SeedObject function,
+									  SeedObject this_object,
+									  size_t argument_count,
+									  const SeedValue arguments[],
+									  SeedException * exception);
 
 void seed_create_function(gchar * name, SeedFunctionCallback,
-			  SeedObject object);
+						  SeedObject object);
 
 #endif



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