seed r102 - trunk/libseed



Author: racarr
Date: Tue Nov  4 05:43:44 2008
New Revision: 102
URL: http://svn.gnome.org/viewvc/seed?rev=102&view=rev

Log:
indent -nbad -bap -nbc -bbo -hnl -br -brs -c33 -cd33 -ncdb -ce -ci4 
-cli0 -d0 -di1 -nfc1 -i8 -ip0 -l80 -lp -npcs -nprs -npsl 
-sai -saf -saw -ncs -nsc -sob -nfca -cp33 -ss -ts8 -il1


Modified:
   trunk/libseed/seed-builtins.c
   trunk/libseed/seed-builtins.h
   trunk/libseed/seed-engine.c
   trunk/libseed/seed-engine.h
   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	Tue Nov  4 05:43:44 2008
@@ -17,7 +17,6 @@
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-
 #include "seed-private.h"
 #include <readline/readline.h>
 #include <readline/history.h>
@@ -25,130 +24,121 @@
 
 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)
 {
 	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);
-			return JSValueMakeNull(eng->context);
+	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);
+		return JSValueMakeNull(eng->context);
 	}
 	import_file = seed_value_to_string(arguments[0]);
-	
+
 	g_file_get_contents(import_file, &buffer, 0, 0);
-	
-	if(!buffer)
-	{
+
+	if (!buffer) {
 		//gchar * mes = g_strdup_printf("File not found: %s.\n", import_file);
 		//seed_make_exception(exception, "FileNotFound", mes);
 		//g_free(mes);
-		return 0; // TODO: raise exception?
+		return 0;	// TODO: raise exception?
 	}
-	
+
 	walk = buffer;
-	
-	if(*walk == '#')
-	{
-		while(*walk != '\n')
+
+	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);
-	
+	JSEvaluateScript(ctx, file_contents, NULL, file_name, 0, NULL);
+
 	JSStringRelease(file_contents);
 	JSStringRelease(file_name);
-	
+
 	return 0;
 }
 
 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);
-			return JSValueMakeNull(eng->context);
+	   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);
+		return JSValueMakeNull(eng->context);
 	}
-	
-	gchar * buf = seed_value_to_string(arguments[0]);
+
+	gchar *buf = seed_value_to_string(arguments[0]);
 	printf("%s\n", buf);
 	free(buf);
-	
+
 	return JSValueMakeNull(eng->context);
 }
 
 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)
 {
 	// 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)
-	{
-			gchar * mes = g_strdup_printf("Seed.readline Expected 1 argument, "
-										  "got %d", argumentCount);
-			seed_make_exception(exception, "ArgumentError", mes);
-			return JSValueMakeNull(eng->context);
+	gchar *str = 0;
+	gchar *buf;
+
+	if (argumentCount != 1) {
+		gchar *mes =
+		    g_strdup_printf("Seed.readline Expected 1 argument, "
+				    "got %d", argumentCount);
+		seed_make_exception(exception, "ArgumentError", mes);
+		return JSValueMakeNull(eng->context);
 	}
 
 	buf = seed_value_to_string(arguments[0]);
-	
+
 	str = readline(buf);
-	if(str && *str)
-	{
+	if (str && *str) {
 		add_history(str);
 		valstr = seed_value_from_string(str);
 		free(str);
 	}
-	
+
 	free(buf);
-	
-	if(valstr == 0)
+
+	if (valstr == 0)
 		valstr = JSValueMakeNull(eng->context);
-	
+
 	return valstr;
 }
 
 JSValueRef
 seed_prototype(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)
 {
 	GType type;
 
@@ -156,43 +146,39 @@
 		return JSValueMakeNull(eng->context);
 	if (!JSValueIsObject(eng->context, arguments[0]))
 		return JSValueMakeNull(eng->context);
-	
-	type = (GType)JSObjectGetPrivate((JSObjectRef)arguments[0]);
-	
+
+	type = (GType) JSObjectGetPrivate((JSObjectRef) arguments[0]);
+
 	return seed_gobject_get_prototype_for_gtype(type);
 }
 
-const char * seed_g_type_name_to_string(GITypeInfo * type)
+const char *seed_g_type_name_to_string(GITypeInfo * type)
 {
 	GITypeTag type_tag = g_type_info_get_tag(type);
-	
-	const char * type_name;
-	
-	if (type_tag == GI_TYPE_TAG_INTERFACE)
-	{
-		GIBaseInfo * interface = g_type_info_get_interface(type);
+
+	const char *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
-	{
+	} else {
 		type_name = g_type_tag_to_string(type_tag);
 	}
-	
+
 	return type_name;
 }
 
 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)
 {
 	// TODO: LEAKY!
-	
-	GICallableInfo * info;
+
+	GICallableInfo *info;
 	JSObjectRef data_obj, args_obj;
 	int i;
 
@@ -201,77 +187,76 @@
 	if (!JSValueIsObject(eng->context, arguments[0]))
 		return JSValueMakeNull(eng->context);
 	if (!JSValueIsObjectOfClass(eng->context, arguments[0],
-							    gobject_method_class))
+				    gobject_method_class))
 		return JSValueMakeNull(eng->context);
-	
-	info = (GICallableInfo*)JSObjectGetPrivate((JSObjectRef)arguments[0]);
+
+	info =
+	    (GICallableInfo *) JSObjectGetPrivate((JSObjectRef) arguments[0]);
 	data_obj = JSObjectMake(eng->context, NULL, NULL);
-	
-	seed_value_set_property(data_obj, "name", 
-							(JSValueRef)seed_value_from_string(
-							g_base_info_get_name((GIBaseInfo*)info)));
-	
-	seed_value_set_property(data_obj, "return_type", 
-		seed_value_from_string(seed_g_type_name_to_string(
-			g_callable_info_get_return_type(info))));
-	
+
+	seed_value_set_property(data_obj, "name",
+				(JSValueRef)
+				seed_value_from_string(g_base_info_get_name
+						       ((GIBaseInfo *) info)));
+
+	seed_value_set_property(data_obj, "return_type",
+				seed_value_from_string
+				(seed_g_type_name_to_string
+				 (g_callable_info_get_return_type(info))));
+
 	args_obj = JSObjectMake(eng->context, NULL, NULL);
-	
+
 	seed_value_set_property(data_obj, "args", args_obj);
-	
-	for(i = 0; i < g_callable_info_get_n_args(info); ++i)
-	{
+
+	for (i = 0; i < g_callable_info_get_n_args(info); ++i) {
 		JSObjectRef argument = JSObjectMake(eng->context, NULL, NULL);
-		
-		const gchar * arg_name = seed_g_type_name_to_string(
-			g_arg_info_get_type(g_callable_info_get_arg(info, i)));
-		
+
+		const gchar *arg_name =
+		    seed_g_type_name_to_string(g_arg_info_get_type
+					       (g_callable_info_get_arg
+						(info, i)));
+
 		seed_value_set_property(argument, "type",
-			seed_value_from_string(arg_name));
+					seed_value_from_string(arg_name));
 
-		JSObjectSetPropertyAtIndex(eng->context, args_obj, i, argument, NULL);
+		JSObjectSetPropertyAtIndex(eng->context, 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(eng->context, 
-											arguments[0], 
-											exception);
-				JSCheckScriptSyntax(ctx, jsstr, 0, 0, exception);
-				if (jsstr)
-						JSStringRelease(jsstr);
-		}
-		else
-		{
-				gchar * mes = g_strdup_printf("Seed.check_syntax expected"
-											  "1 argument, got %d",
-											  argumentCount);
-		}
-		return JSValueMakeNull(eng->context);
+		  JSObjectRef function,
+		  JSObjectRef this_object,
+		  size_t argumentCount,
+		  const JSValueRef arguments[], JSValueRef * exception)
+{
+	if (argumentCount != 0) {
+		JSStringRef jsstr = JSValueToStringCopy(eng->context,
+							arguments[0],
+							exception);
+		JSCheckScriptSyntax(ctx, jsstr, 0, 0, exception);
+		if (jsstr)
+			JSStringRelease(jsstr);
+	} else {
+		gchar *mes = g_strdup_printf("Seed.check_syntax expected"
+					     "1 argument, got %d",
+					     argumentCount);
+	}
+	return JSValueMakeNull(eng->context);
 }
 
 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;
-	
+
 	child = fork();
 	return seed_value_from_int(child);
 }
@@ -279,27 +264,26 @@
 static gboolean seed_timeout_function(gpointer user_data)
 {
 	// Evaluate timeout script
-	
-	const JSStringRef script = (const JSStringRef) user_data;
+
+	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)
+		 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);
+	//      return JSValueMakeBoolean(ctx, 0);
 
 	// TODO: convert to use an exception! (Matt!)
 
@@ -307,22 +291,23 @@
 		return JSValueMakeBoolean(ctx, 0);
 
 	JSStringRef jsstr = JSValueToStringCopy(eng->context,
-											arguments[0],
-											exception);
-	
+						arguments[0],
+						exception);
+
 	guint interval = seed_value_to_uint(arguments[1]);
 	g_timeout_add(interval, &seed_timeout_function, jsstr);
 
 	return JSValueMakeBoolean(ctx, 1);
 }
 
-void seed_init_builtins(int * argc, char *** argv)
+void seed_init_builtins(int *argc, char ***argv)
 {
 	int i;
 	JSObjectRef arrayObj;
 	JSValueRef argcref;
-	JSObjectRef obj = (JSObjectRef)seed_value_get_property(eng->global, "Seed");
-	
+	JSObjectRef obj =
+	    (JSObjectRef) seed_value_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);
@@ -331,20 +316,19 @@
 	seed_create_function("introspect", &seed_introspect, obj);
 	seed_create_function("fork", &seed_fork, obj);
 	seed_create_function("setTimeout", &seed_set_timeout, obj);
-	
+
 	arrayObj = JSObjectMake(eng->context, NULL, NULL);
-	
-	for(i = 0; i < *argc; ++i)
-	{
+
+	for (i = 0; i < *argc; ++i) {
 		// TODO: exceptions!
-		
+
 		JSObjectSetPropertyAtIndex(eng->context, arrayObj, i,
-								   seed_value_from_string((*argv)[i]), NULL);
+					   seed_value_from_string((*argv)[i]),
+					   NULL);
 	}
-	
+
 	argcref = seed_value_from_int(*argc);
 
 	seed_value_set_property(arrayObj, "length", argcref);
 	seed_value_set_property(obj, "argv", arrayObj);
 }
-

Modified: trunk/libseed/seed-builtins.h
==============================================================================
--- trunk/libseed/seed-builtins.h	(original)
+++ trunk/libseed/seed-builtins.h	Tue Nov  4 05:43:44 2008
@@ -17,7 +17,6 @@
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-
 #ifndef _SEED_BUILTINS_H_
 #define _SEED_BUILTINS_H_
 
@@ -27,37 +26,32 @@
 
 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();
 
 #endif
-

Modified: trunk/libseed/seed-engine.c
==============================================================================
--- trunk/libseed/seed-engine.c	(original)
+++ trunk/libseed/seed-engine.c	Tue Nov  4 05:43:44 2008
@@ -17,7 +17,6 @@
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-
 #include "seed-private.h"
 
 #include <string.h>
@@ -27,861 +26,773 @@
 
 JSClassRef gobject_signal_class;
 
-GParamSpec ** global_prop_cache;
-
-gchar * glib_message = 0;
+GParamSpec **global_prop_cache;
 
+gchar *glib_message = 0;
 
-void seed_make_exception(JSValueRef * exception, 
-								const gchar * name, const gchar * message)
+void seed_make_exception(JSValueRef * exception,
+			 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;
+	JSStringRef js_name = 0;
+	JSStringRef js_message = 0;
+	JSValueRef js_name_ref = 0, js_message_ref = 0;
+	JSObjectRef exception_obj;
+
+	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_value_set_property(exception_obj, "message", js_message_ref);
+	seed_value_set_property(exception_obj, "name", js_name_ref);
 
-		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_value_set_property(exception_obj, "message", js_message_ref);
-		seed_value_set_property(exception_obj, "name", js_name_ref);
+	*exception = exception_obj;
 
-		*exception = exception_obj;
-
-		JSStringRelease(js_name);
-		JSStringRelease(js_message);
+	JSStringRelease(js_name);
+	JSStringRelease(js_message);
 }
 
 static JSObjectRef
-seed_gobject_constructor_invoked (JSContextRef ctx,
-								  JSObjectRef constructor,
-								  size_t argumentCount,
-								  const JSValueRef arguments[],
-								  JSValueRef * exception)
-{
+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;
+	int 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);
+
+	g_assert(argumentCount <= 1);
+
+	if (argumentCount == 1) {
+		jsprops = JSObjectCopyPropertyNames(eng->context,
+						    (JSObjectRef) arguments[0]);
+		nparams = JSPropertyNameArrayGetCount(jsprops);
+	}
+	i = 0;
+
+	params = g_new0(GParameter, nparams + 1);
+
+	// TODO: make sure we don't die if we get passed something other than an object
+
+	while (i < nparams) {
 		GType type;
-		GParameter *params;
-		GObjectClass *oclass;
-		GObject * gobject;
-		// Do we free GParamSpecs...? It's not clear.
-		GParamSpec * param_spec;
-		gchar * prop_name;
-		int 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);
-	
-		g_assert(argumentCount <= 1);
-	
-		if(argumentCount == 1)
-		{
-				jsprops = JSObjectCopyPropertyNames(eng->context, 
-													(JSObjectRef)arguments[0]);
-				nparams = JSPropertyNameArrayGetCount(jsprops);
-		}
-		i = 0;
-	
-		params = g_new0(GParameter, nparams + 1);
-	
-		// TODO: make sure we don't die if we get passed something other than an object
-	
-		while(i < nparams)
-		{
-				GType type;
-				jsprop_name = JSPropertyNameArrayGetNameAtIndex(jsprops, i);
-		
-				length = JSStringGetMaximumUTF8CStringSize(jsprop_name);
-				prop_name = malloc(length * sizeof(gchar));
-				JSStringGetUTF8CString(jsprop_name, prop_name, length);
-		
-				param_spec = g_object_class_find_property (oclass, prop_name);
-				if (param_spec == NULL)
-						g_error("Constructor called "
-								"with invalid property \n");
-				
-				// 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 (!seed_gvalue_from_seed_value(
-							jsprop_value,
-							type,
-							&params[i].value))
-				{
-						g_free(prop_name);
-						g_free(params);
-						return 0;
-				}
-				params[i].name = prop_name;
-		
-				++i;
+		jsprop_name = JSPropertyNameArrayGetNameAtIndex(jsprops, i);
+
+		length = JSStringGetMaximumUTF8CStringSize(jsprop_name);
+		prop_name = malloc(length * sizeof(gchar));
+		JSStringGetUTF8CString(jsprop_name, prop_name, length);
+
+		param_spec = g_object_class_find_property(oclass, prop_name);
+		if (param_spec == NULL)
+			g_error("Constructor called "
+				"with invalid property \n");
+
+		// 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 (!seed_gvalue_from_seed_value(jsprop_value,
+						 type, &params[i].value)) {
+			g_free(prop_name);
+			g_free(params);
+			return 0;
 		}
+		params[i].name = prop_name;
+
+		++i;
+	}
+
+	if (jsprops)
+		JSPropertyNameArrayRelease(jsprops);
+
+	gobject = g_object_newv(type, nparams, params);
+
+	if (!gobject)
+		JSValueMakeNull(eng->context);
 
-		if (jsprops)
-				JSPropertyNameArrayRelease(jsprops);
-	
-		gobject = g_object_newv(type, nparams, params);
-	
-		if (!gobject)
-				JSValueMakeNull(eng->context);
-
-		ret = (JSObjectRef)seed_value_from_object(gobject);
-
-		g_type_class_unref(oclass);
-	
-		g_free(params);
-	
-		return ret;
+	ret = (JSObjectRef) seed_value_from_object(gobject);
+
+	g_type_class_unref(oclass);
+
+	g_free(params);
+
+	return ret;
 }
 
 static JSValueRef
-seed_gobject_equals (JSContextRef ctx,
-							JSObjectRef function,
-							JSObjectRef this_object,
-							size_t argumentCount,
-							const JSValueRef arguments[],
-							JSValueRef * exception)
+seed_gobject_equals(JSContextRef ctx,
+		    JSObjectRef function,
+		    JSObjectRef this_object,
+		    size_t argumentCount,
+		    const JSValueRef arguments[], JSValueRef * exception)
 {
-	GObject * this, * that;
-	
+	GObject *this, *that;
+
 	g_assert(argumentCount == 1);
 
-	this = seed_value_to_object((JSValueRef)this_object);
+	this = seed_value_to_object((JSValueRef) this_object);
 	that = seed_value_to_object(arguments[0]);
-	
+
 	if (this == that)
 		return seed_value_from_boolean(1);
 	return seed_value_from_boolean(0);
 }
 
-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;
-		int 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);
-		if (!
-			((object = seed_value_to_object(this_object)) ||
-			 (object = seed_struct_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);
-		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++]))
-						{
-								g_error("Unable to make argument %d for"
-										" function: %s. \n",
-										i+1, g_base_info_get_name(
-												(GIBaseInfo*)info));
-						}
-						if (dir == GI_DIRECTION_INOUT)
-								n_out_args++;
-			    
+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;
+	int 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);
+	if (!
+	    ((object = seed_value_to_object(this_object)) ||
+	     (object = seed_struct_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);
+	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++])) {
+				g_error("Unable to make argument %d for"
+					" function: %s. \n",
+					i + 1, g_base_info_get_name((GIBaseInfo
+								     *) info));
+			}
+			if (dir == GI_DIRECTION_INOUT)
+				n_out_args++;
+
+		} else if (dir == GI_DIRECTION_OUT) {
+			n_out_args++;
+		}
+
+		g_base_info_unref((GIBaseInfo *) type_info);
+		g_base_info_unref((GIBaseInfo *) arg_info);
+	}
+	if (g_function_info_invoke((GIFunctionInfo *) info,
+				   in_args,
+				   n_in_args,
+				   out_args, n_out_args, &retval, &error)) {
+		type_info = g_callable_info_get_return_type((GICallableInfo *)
+							    info);
+		if (g_type_info_get_tag(type_info) == GI_TYPE_TAG_VOID)
+			retval_ref = JSValueMakeNull(eng->context);
+		else
+			retval_ref =
+			    seed_gi_argument_make_js(&retval, type_info);
+		g_base_info_unref((GIBaseInfo *) type_info);
+	} else {
+		g_error("Error invoking function, %s. %s \n",
+			g_base_info_get_name((GIBaseInfo *) info),
+			error->message);
+	}
 
+	g_free(in_args);
+	g_free(out_args);
+	return retval_ref;
+}
 
-				}
-				else if (dir == GI_DIRECTION_OUT)
-				{
-						n_out_args++;
-				}
+void seed_gobject_define_property_from_function_info(GIFunctionInfo * info,
+						     JSObjectRef object,
+						     gboolean instance)
+{
+	GIFunctionInfoFlags flags;
+	SeedValue method_ref;
+	const gchar *name;
 
-				g_base_info_unref((GIBaseInfo *) type_info);
-				g_base_info_unref((GIBaseInfo *) arg_info);
-		}
-		if (g_function_info_invoke((GIFunctionInfo*)info,
-								   in_args,
-								   n_in_args,
-								   out_args,
-								   n_out_args,
-								   &retval,
-								   &error))
-		{
-				type_info = 
-						g_callable_info_get_return_type((GICallableInfo *)
-														info);
-				if (g_type_info_get_tag(type_info) == GI_TYPE_TAG_VOID)
-						retval_ref = JSValueMakeNull(eng->context);
-				else
-						retval_ref = 
-								seed_gi_argument_make_js(&retval, type_info);
-				g_base_info_unref((GIBaseInfo*)type_info);
-		}
-		else
-		{
-				g_error("Error invoking function, %s. %s \n",
-						g_base_info_get_name((GIBaseInfo *) info),
-						error->message);
-		}
+	//if (g_base_info_is_deprecated ((GIBaseInfo *) info))
+	//      g_printf("Not defining deprecated symbol: %s \n",
+	//               g_base_info_get_name((GIBaseInfo *)info));
 
-		g_free(in_args);
-		g_free(out_args);
-		return retval_ref;
-}
-
-void seed_gobject_define_property_from_function_info(GIFunctionInfo *info, 
-													 JSObjectRef object, 
-													 gboolean instance)
-{
-		GIFunctionInfoFlags flags;
-		SeedValue 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))
+	flags = g_function_info_get_flags(info);
 
-		{
-				return;
-		}
-	
-	
-		method_ref = JSObjectMake(eng->context, gobject_method_class, info);
+	if (instance && (flags & GI_FUNCTION_IS_CONSTRUCTOR))
+	{
+		return;
+	}
 
-		name = g_base_info_get_name((GIBaseInfo *) info);
-		if (!strcmp(name, "new"))
-			name = "_new";
-		seed_value_set_property(object, 
-								name,
-								method_ref);
+	method_ref = JSObjectMake(eng->context, gobject_method_class, info);
 
-}
+	name = g_base_info_get_name((GIBaseInfo *) info);
+	if (!strcmp(name, "new"))
+		name = "_new";
+	seed_value_set_property(object, name, method_ref);
 
+}
 
-static void seed_gobject_add_methods_for_interfaces(GIObjectInfo * oinfo, JSObjectRef object)
+static void seed_gobject_add_methods_for_interfaces(GIObjectInfo * oinfo,
+						    JSObjectRef object)
 {
-		GIInterfaceInfo * interface;
-		gint n_interfaces, i;
-	
-		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++)
-				{
-						function = g_interface_info_get_method(interface, k);
-						seed_gobject_define_property_from_function_info
-							(function, object, TRUE);
-				}
-				//	g_base_info_unref((GIBaseInfo*)interface);
+	GIInterfaceInfo *interface;
+	gint n_interfaces, i;
+
+	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++) {
+			function = g_interface_info_get_method(interface, k);
+			seed_gobject_define_property_from_function_info
+			    (function, object, TRUE);
 		}
+		//      g_base_info_unref((GIBaseInfo*)interface);
+	}
 }
 
-static void seed_gobject_add_methods_for_type(GIObjectInfo * oinfo, JSObjectRef object)
+static void seed_gobject_add_methods_for_type(GIObjectInfo * oinfo,
+					      JSObjectRef object)
 {
-		int n_methods;
-		int i;
-		GIFunctionInfo * info;
+	int n_methods;
+	int i;
+	GIFunctionInfo *info;
 
-		n_methods = g_object_info_get_n_methods(oinfo);
+	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);
-		}
+	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)
+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;
-	
-		if ((ref = g_type_get_qdata (type, qname)) != NULL)
-		{
-				return ref;
-		}
+	JSClassDefinition def;
+	GType parent;
+	JSClassRef ref;
+	JSClassRef parent_class = 0;
+	GIBaseInfo *info;
+	JSObjectRef prototype_obj;
+	JSObjectRef parent_prototype;
 
-		info = g_irepository_find_by_gtype(g_irepository_get_default(),
-										   type);
+	if ((ref = g_type_get_qdata(type, qname)) != NULL) {
+		return ref;
+	}
 
+	info = g_irepository_find_by_gtype(g_irepository_get_default(), type);
 
-		
-		if (!info || !(g_base_info_get_type(info) == GI_INFO_TYPE_OBJECT))
-				return 0;
+	if (!info || !(g_base_info_get_type(info) == GI_INFO_TYPE_OBJECT))
+		return 0;
 
-		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;
+	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);
-		}
-		seed_gobject_add_methods_for_type((GIObjectInfo *)info, prototype_obj);
-		seed_gobject_add_methods_for_interfaces((GIObjectInfo *) info, 
-												prototype_obj);
-	
-		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);
+	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);
+	}
+	seed_gobject_add_methods_for_type((GIObjectInfo *) info, prototype_obj);
+	seed_gobject_add_methods_for_interfaces((GIObjectInfo *) info,
+						prototype_obj);
 
+	ref = JSClassCreate(&def);
+	JSClassRetain(ref);
 
+	JSValueProtect(eng->context, prototype_obj);
 
-		return ref;
+	g_type_set_qdata(type, qname, ref);
+	g_type_set_qdata(type, qprototype, prototype_obj);
+
+	return ref;
 }
 
 JSObjectRef seed_gobject_get_prototype_for_gtype(GType type)
 {
 
-		return g_type_get_qdata(type, qprototype);
+	return g_type_get_qdata(type, qprototype);
 }
 
 static void seed_gobject_finalize(JSObjectRef object)
 {
-		GObject * gobject;
-	
-		gobject = seed_value_to_object((JSValueRef)object);
-		if (!gobject)
-				return;
-
-		g_object_unref(gobject);
-}
-
-static void seed_gobject_initialize(JSContextRef ctx,				    
-									JSObjectRef object)
-{
-		GObject * gobject;
-		GIBaseInfo * base;
-	
-		gobject = seed_value_to_object((JSValueRef)object);
-		if (!gobject)
-				return;
+	GObject *gobject;
 
-		base = g_irepository_find_by_gtype(g_irepository_get_default(),
-										   G_OBJECT_TYPE(gobject));
+	gobject = seed_value_to_object((JSValueRef) object);
+	if (!gobject)
+		return;
 
-		seed_add_signals_to_object(object, gobject);
-		if (!base)
-		{
-				return;
-		}
-		g_assert(g_base_info_get_type(base) == GI_INFO_TYPE_OBJECT);
-	
+	g_object_unref(gobject);
 }
 
-static JSValueRef seed_gobject_get_property(JSContextRef context, 
-											JSObjectRef object, 
-											JSStringRef property_name,
-											JSValueRef * exception)
-{
-		GParamSpec * spec;
-		GObject * b;
-		GValue gval = {0};
-		char * cproperty_name;
-		int length;
-		SeedValue ret;
-		int i, len;
-
-		b = seed_value_to_object((JSValueRef)object);
-		if (!b)
-			return 0;
+static void seed_gobject_initialize(JSContextRef ctx, JSObjectRef object)
+{
+	GObject *gobject;
+	GIBaseInfo *base;
 
-		length = JSStringGetMaximumUTF8CStringSize(property_name);
-		cproperty_name = malloc(length * sizeof(gchar));
-		JSStringGetUTF8CString(property_name, cproperty_name, length); 
-	
-	
-		spec = g_object_class_find_property(G_OBJECT_GET_CLASS(b),
-											cproperty_name);
+	gobject = seed_value_to_object((JSValueRef) object);
+	if (!gobject)
+		return;
 
-		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);
-				g_free(cproperty_name);
-				return 0;
-		}
+	base = g_irepository_find_by_gtype(g_irepository_get_default(),
+					   G_OBJECT_TYPE(gobject));
 
-	
-	
-		g_value_init(&gval, spec->value_type);
-		g_object_get_property(b, cproperty_name, &gval);
-		ret = seed_value_from_gvalue(&gval);
-		g_value_unset(&gval);
+	seed_add_signals_to_object(object, gobject);
+	if (!base) {
+		return;
+	}
+	g_assert(g_base_info_get_type(base) == GI_INFO_TYPE_OBJECT);
 
-		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;
-		int length;
-
-		if (JSValueIsNull(eng->context, value))
-				return 0;
+static JSValueRef seed_gobject_get_property(JSContextRef context,
+					    JSObjectRef object,
+					    JSStringRef property_name,
+					    JSValueRef * exception)
+{
+	GParamSpec *spec;
+	GObject *b;
+	GValue gval = { 0 };
+	char *cproperty_name;
+	int length;
+	SeedValue ret;
+	int i, len;
 
-		obj = seed_value_to_object(object);
-		if (!obj || !G_IS_OBJECT(obj))
-				return FALSE;
-	
-	
-		length = JSStringGetMaximumUTF8CStringSize(property_name);
-		cproperty_name = malloc(length * sizeof(gchar));
-		JSStringGetUTF8CString(property_name, cproperty_name, length); 
+	b = seed_value_to_object((JSValueRef) object);
+	if (!b)
+		return 0;
 
-		spec = g_object_class_find_property(G_OBJECT_GET_CLASS(obj),
-											cproperty_name);
+	length = JSStringGetMaximumUTF8CStringSize(property_name);
+	cproperty_name = malloc(length * sizeof(gchar));
+	JSStringGetUTF8CString(property_name, cproperty_name, length);
 
-		if (!spec)
-		{
-				int 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;
+	spec = g_object_class_find_property(G_OBJECT_GET_CLASS(b),
+					    cproperty_name);
 
-		if (!seed_gvalue_from_seed_value(value, type, &gval))
-		{
-				gchar * mes = g_strdup_printf("Not able to set property %s"
-											  "on object of type %s."
-											  " Expected type: %s. \n",
-											  cproperty_name, 
-											  g_type_name(G_OBJECT_TYPE(obj)),
-											  g_type_name(spec->value_type));
-				seed_make_exception(exception, "InvalidPropertyValue", mes);
-				g_free(mes);
-				g_free(cproperty_name);
-				return 0;
+	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);
+		g_free(cproperty_name);
+		return 0;
+	}
 
-		g_object_set_property(obj, cproperty_name, &gval);
-		if (glib_message != 0)
-		{
-				seed_make_exception(exception, "PropertyError", glib_message);
+	g_value_init(&gval, spec->value_type);
+	g_object_get_property(b, cproperty_name, &gval);
+	ret = seed_value_from_gvalue(&gval);
+	g_value_unset(&gval);
 
-				g_free(glib_message);
-				glib_message = 0;
-				return FALSE;
-		}
-		g_free(cproperty_name);
-	
-		return TRUE;
+	g_free(cproperty_name);
+	return (JSValueRef) ret;
 }
 
-static JSValueRef
-seed_gi_import_namespace(JSContextRef ctx,
-						 JSObjectRef function,
-						 JSObjectRef this_object,
-						 size_t argumentCount,
-						 const JSValueRef arguments[],
-						 JSValueRef * exception)
-{
-		GIBaseInfo * info;
-		const gchar * namespace;
-		const gchar * extension;
-		const gchar * version = 0;
-		JSObjectRef namespace_ref;
-		JSStringRef extension_script;
-		int n,i;
-	
-		namespace = seed_value_to_string(arguments[0]);
-		if (argumentCount == 2)
-		{
-				version = seed_value_to_string(arguments[1]);
+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;
+	int length;
+
+	if (JSValueIsNull(eng->context, value))
+		return 0;
+
+	obj = seed_value_to_object(object);
+	if (!obj || !G_IS_OBJECT(obj))
+		return FALSE;
+
+	length = JSStringGetMaximumUTF8CStringSize(property_name);
+	cproperty_name = malloc(length * sizeof(gchar));
+	JSStringGetUTF8CString(property_name, cproperty_name, length);
+
+	spec = g_object_class_find_property(G_OBJECT_GET_CLASS(obj),
+					    cproperty_name);
+
+	if (!spec) {
+		int i, len;
+		len = strlen(cproperty_name);
+		for (i = 0; i < len; i++) {
+			if (cproperty_name[i] == '_')
+				cproperty_name[i] = '-';
 		}
-	
-		if(!g_irepository_require (g_irepository_get_default (), namespace,
-								   version, 0, NULL))
-		{
-				gchar * mes;
-				if (!version)
-				{
-						mes = g_strdup_printf("No such namespace: %s", 
-											  namespace);
-				}
-				else
-				{
-						mes =
-					    g_strdup_printf("No such namespace: %s (version %s)", 
-										namespace, version);
-				}
-				seed_make_exception(exception, "NamespaceError",mes);
-				return JSValueMakeNull(eng->context);
+		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;
+
+	if (!seed_gvalue_from_seed_value(value, type, &gval)) {
+		gchar *mes = g_strdup_printf("Not able to set property %s"
+					     "on object of type %s."
+					     " Expected type: %s. \n",
+					     cproperty_name,
+					     g_type_name(G_OBJECT_TYPE(obj)),
+					     g_type_name(spec->value_type));
+		seed_make_exception(exception, "InvalidPropertyValue", mes);
+		g_free(mes);
+		g_free(cproperty_name);
+		return 0;
+	}
 
-		n = g_irepository_get_n_infos(g_irepository_get_default(),
-									  namespace);
-	
-		namespace_ref = JSObjectMake(eng->context,
-									 NULL, NULL);
-		JSValueProtect(eng->context, namespace_ref);
-		seed_value_set_property(eng->global, namespace, namespace_ref);
+	g_object_set_property(obj, cproperty_name, &gval);
+	if (glib_message != 0) {
+		seed_make_exception(exception, "PropertyError", glib_message);
+
+		g_free(glib_message);
+		glib_message = 0;
+		return FALSE;
+	}
+	g_free(cproperty_name);
 
-		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))
-				{
-						int num_vals = 
-								g_enum_info_get_n_values((GIEnumInfo *) info);
-						int j;
-						JSObjectRef enum_class = JSObjectMake(eng->context,
-															  0,0);
-						JSValueProtect(eng->context, (JSValueRef) enum_class);
-						seed_value_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));
-								int name_len = strlen(name);
-								int 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_value_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;
-								int 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);
-
-
-								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_value_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;
-						int i, n_methods;
-						GIFunctionInfo *finfo;
-						
-						struct_ref = JSObjectMake(eng->context, 0, 0);
-						
-						n_methods =
-							g_struct_info_get_n_methods((GIStructInfo *)info);
-
-						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_value_set_property(namespace_ref,
-												g_base_info_get_name(info),
-												struct_ref);
+	return TRUE;
+}
 
-						JSValueProtect(eng->context,
-									   (JSValueRef)struct_ref);
-				}
+static JSValueRef
+seed_gi_import_namespace(JSContextRef ctx,
+			 JSObjectRef function,
+			 JSObjectRef this_object,
+			 size_t argumentCount,
+			 const JSValueRef arguments[], JSValueRef * exception)
+{
+	GIBaseInfo *info;
+	const gchar *namespace;
+	const gchar *extension;
+	const gchar *version = 0;
+	JSObjectRef namespace_ref;
+	JSStringRef extension_script;
+	int n, i;
+
+	namespace = seed_value_to_string(arguments[0]);
+	if (argumentCount == 2) {
+		version = seed_value_to_string(arguments[1]);
+	}
+
+	if (!g_irepository_require(g_irepository_get_default(), namespace,
+				   version, 0, NULL)) {
+		gchar *mes;
+		if (!version) {
+			mes = g_strdup_printf("No such namespace: %s",
+					      namespace);
+		} else {
+			mes =
+			    g_strdup_printf
+			    ("No such namespace: %s (version %s)", namespace,
+			     version);
 		}
-		
+		seed_make_exception(exception, "NamespaceError", mes);
+		return JSValueMakeNull(eng->context);
+	}
 
-		extension = g_strdup_printf("Seed.include(\"/usr/local/share/seed/%s.js\")", 
-									namespace);
-		extension_script = JSStringCreateWithUTF8CString(extension);
-		JSEvaluateScript(eng->context, extension_script, NULL, NULL, 0, NULL);
-		JSStringRelease(extension_script);
+	n = g_irepository_get_n_infos(g_irepository_get_default(), namespace);
 
-		g_free((gchar *)namespace);
+	namespace_ref = JSObjectMake(eng->context, NULL, NULL);
+	JSValueProtect(eng->context, namespace_ref);
+	seed_value_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)) {
+			int num_vals =
+			    g_enum_info_get_n_values((GIEnumInfo *) info);
+			int j;
+			JSObjectRef enum_class = JSObjectMake(eng->context,
+							      0, 0);
+			JSValueProtect(eng->context, (JSValueRef) enum_class);
+			seed_value_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));
+				int name_len = strlen(name);
+				int 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_value_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;
+				int 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);
+
+				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_value_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;
+			int i, n_methods;
+			GIFunctionInfo *finfo;
+
+			struct_ref = JSObjectMake(eng->context, 0, 0);
+
+			n_methods =
+			    g_struct_info_get_n_methods((GIStructInfo *) info);
+
+			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_value_set_property(namespace_ref,
+						g_base_info_get_name(info),
+						struct_ref);
+
+			JSValueProtect(eng->context, (JSValueRef) struct_ref);
+		}
+	}
+
+	extension =
+	    g_strdup_printf("Seed.include(\"/usr/local/share/seed/%s.js\")",
+			    namespace);
+	extension_script = JSStringCreateWithUTF8CString(extension);
+	JSEvaluateScript(eng->context, extension_script, NULL, NULL, 0, NULL);
+	JSStringRelease(extension_script);
 
-		return JSValueMakeNull(eng->context);
+	g_free((gchar *) namespace);
+
+	return JSValueMakeNull(eng->context);
 }
 
 JSStaticFunction gobject_static_funcs[] = {
-	{"equals", seed_gobject_equals, 0},
+	{"equals", seed_gobject_equals, 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 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(char * name, gpointer func, JSObjectRef obj)
+void seed_create_function(char *name, gpointer func, JSObjectRef obj)
 {
-		JSObjectRef oref;
-	
-		oref = JSObjectMakeFunctionWithCallback(eng->context, NULL, func);
-		JSValueProtect(eng->context, oref);
-		seed_value_set_property(obj, name, oref);
+	JSObjectRef oref;
+
+	oref = JSObjectMakeFunctionWithCallback(eng->context, NULL, func);
+	JSValueProtect(eng->context, oref);
+	seed_value_set_property(obj, name, oref);
 }
 
-static void seed_log_handler (const gchar * domain,
-							  GLogLevelFlags log_level,
-							  const gchar * message,
-							  gpointer user_data)
+static void seed_log_handler(const gchar * domain,
+			     GLogLevelFlags log_level,
+			     const gchar * message, gpointer user_data)
 {
-		glib_message = g_strdup(message);
+	glib_message = g_strdup(message);
 }
 
-gboolean seed_init(int * argc, char *** argv)
+gboolean seed_init(int *argc, char ***argv)
 {
 	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);
 
 	qname = g_quark_from_static_string("js-type");
 	qprototype = g_quark_from_static_string("js-prototype");
-	
-	eng = (SeedEngine *)malloc(sizeof(SeedEngine));
-	
-	eng->context = JSGlobalContextCreateInGroup(NULL,NULL);
+
+	eng = (SeedEngine *) malloc(sizeof(SeedEngine));
+
+	eng->context = JSGlobalContextCreateInGroup(NULL, NULL);
 	eng->global = JSContextGetGlobalObject(eng->context);
 	gobject_class = JSClassCreate(&gobject_def);
 	JSClassRetain(gobject_class);
@@ -891,83 +802,82 @@
 	JSClassRetain(gobject_constructor_class);
 	gobject_signal_class = JSClassCreate(seed_get_signal_class());
 	JSClassRetain(gobject_signal_class);
-	
+
 	g_type_set_qdata(G_TYPE_OBJECT, qname, gobject_class);
-	
+
 	seed_obj_ref = JSObjectMake(eng->context, NULL, NULL);
 	seed_value_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_create_function("import_namespace", &seed_gi_import_namespace,
+			     seed_obj_ref);
 	seed_init_builtins(argc, argv);
-	
-	defaults_script = 
-		JSStringCreateWithUTF8CString("Seed.include(\"/usr/local/share"
-									  "/seed/Seed.js\")");
+
+	defaults_script =
+	    JSStringCreateWithUTF8CString("Seed.include(\"/usr/local/share"
+					  "/seed/Seed.js\")");
 	JSEvaluateScript(eng->context, defaults_script, NULL, NULL, 0, NULL);
 	JSStringRelease(defaults_script);
-	
+
 	return TRUE;
 
 }
 
-SeedScript * seed_make_script(const gchar * js, const gchar * source_url,
-							  int line_number)
+SeedScript *seed_make_script(const gchar * js, const gchar * source_url,
+			     int line_number)
 {
-		SeedScript * ret = g_new0(SeedScript, 1);
+	SeedScript *ret = g_new0(SeedScript, 1);
 
-		ret->script = JSStringCreateWithUTF8CString(js);
-	
-		if (source_url)
-		{
-				ret->source_url = JSStringCreateWithUTF8CString(source_url);
-		}
-		ret->line_number = line_number;
+	ret->script = JSStringCreateWithUTF8CString(js);
 
-		JSCheckScriptSyntax(eng->context, ret->script,
-							ret->source_url, ret->line_number, &ret->exception);
+	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);
 
-		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;
 }
 
-SeedValue seed_script_exception(SeedScript *s)
+SeedValue seed_script_exception(SeedScript * s)
 {
-		return s->exception;
+	return s->exception;
 }
 
-gchar * seed_exception_get_name(JSValueRef e)
+gchar *seed_exception_get_name(JSValueRef e)
 {
-		SeedValue name;
-		g_assert((e));
-		if (!JSValueIsObject(eng->context, e))
-				return 0;
+	SeedValue name;
+	g_assert((e));
+	if (!JSValueIsObject(eng->context, e))
+		return 0;
 
-		name = seed_value_get_property(e, "name");
-		return seed_value_to_string(name);
+	name = seed_value_get_property(e, "name");
+	return seed_value_to_string(name);
 }
 
-gchar * seed_exception_get_message(JSValueRef e)
+gchar *seed_exception_get_message(JSValueRef e)
 {
-		SeedValue name;
-		g_assert((e));
-		if (!JSValueIsObject(eng->context, e))
-				return 0;
+	SeedValue name;
+	g_assert((e));
+	if (!JSValueIsObject(eng->context, e))
+		return 0;
 
-		name = seed_value_get_property(e, "message");
-		return seed_value_to_string(name);
+	name = seed_value_get_property(e, "message");
+	return seed_value_to_string(name);
 }
 
 guint seed_exception_get_line(JSValueRef e)
@@ -975,18 +885,17 @@
 	SeedValue line;
 	g_assert((e));
 	if (!JSValueIsObject(eng->context, e))
-			return 0;
+		return 0;
 	line = seed_value_get_property(e, "line");
 	return seed_value_to_uint(line);
 }
 
-gchar * seed_exception_get_file(JSValueRef e)
+gchar *seed_exception_get_file(JSValueRef e)
 {
 	SeedValue file;
 	g_assert((e));
 	if (!JSValueIsObject(eng->context, e))
-			return 0;
+		return 0;
 	file = seed_value_get_property(e, "sourceURL");
 	return seed_value_to_string(file);
 }
-

Modified: trunk/libseed/seed-engine.h
==============================================================================
--- trunk/libseed/seed-engine.h	(original)
+++ trunk/libseed/seed-engine.h	Tue Nov  4 05:43:44 2008
@@ -17,7 +17,6 @@
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-
 #ifndef _SEED_ENGINE_H
 #define _SEED_ENGINE_H
 
@@ -26,13 +25,12 @@
 extern JSClassRef gobject_class;
 extern JSClassRef gobject_method_class;
 extern JSClassRef gobject_constructor_class;
-extern SeedEngine * eng;
+extern SeedEngine *eng;
 
-typedef struct _SeedScript 
-{
+typedef struct _SeedScript {
 	JSStringRef script;
 	JSValueRef exception;
-	
+
 	JSStringRef source_url;
 	int line_number;
 } SeedScript;
@@ -40,8 +38,10 @@
 JSObjectRef seed_gobject_get_prototype_for_gtype(GType type);
 JSClassRef seed_gobject_get_class_for_gtype(GType type);
 
-void seed_gobject_define_property_from_function_info(GIFunctionInfo *info, JSObjectRef object, gboolean instance);
-void seed_create_function(char * name, gpointer func, JSObjectRef obj);
-void seed_make_exception(JSValueRef * exception, 
-						 const gchar * name, const gchar * message);
+void seed_gobject_define_property_from_function_info(GIFunctionInfo * info,
+						     JSObjectRef object,
+						     gboolean instance);
+void seed_create_function(char *name, gpointer func, JSObjectRef obj);
+void seed_make_exception(JSValueRef * exception,
+			 const gchar * name, const gchar * message);
 #endif

Modified: trunk/libseed/seed-private.h
==============================================================================
--- trunk/libseed/seed-private.h	(original)
+++ trunk/libseed/seed-private.h	Tue Nov  4 05:43:44 2008
@@ -17,7 +17,6 @@
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-
 #ifndef _SEED_PRIVATE_H
 #define _SEED_PRIVATE_H
 
@@ -31,8 +30,7 @@
 typedef struct _SeedEngine SeedEngine;
 typedef JSValueRef SeedValue;
 
-struct _SeedEngine
-{
+struct _SeedEngine {
 	JSGlobalContextRef context;
 	JSObjectRef global;
 };

Modified: trunk/libseed/seed-signals.c
==============================================================================
--- trunk/libseed/seed-signals.c	(original)
+++ trunk/libseed/seed-signals.c	Tue Nov  4 05:43:44 2008
@@ -17,14 +17,13 @@
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-
 #include <string.h>
 
 #include "seed-private.h"
 
-typedef struct _signal_privates{
+typedef struct _signal_privates {
 	guint signal_id;
-	GObject * object;
+	GObject *object;
 } signal_privates;
 
 typedef struct _SeedClosure {
@@ -34,196 +33,165 @@
 	JSObjectRef this;
 } SeedClosure;
 
-
-static void seed_add_signal_to_object(JSObjectRef object_ref, 
-				      GObject * obj,
-				      GSignalQuery * signal)
+static void seed_add_signal_to_object(JSObjectRef object_ref,
+				      GObject * obj, GSignalQuery * signal)
 {
 	guint k;
 	JSObjectRef signal_ref;
-	signal_privates * priv  =
-		malloc(sizeof(signal_privates));
-	gchar * my_signal_name = 
-		g_strdup(signal->signal_name);
-	gchar * modified_signal_name;
-	
+	signal_privates *priv = malloc(sizeof(signal_privates));
+	gchar *my_signal_name = g_strdup(signal->signal_name);
+	gchar *modified_signal_name;
+
 	g_assert(signal);
-	
-	for (k = 0; k < strlen(my_signal_name); k++)
-	{
-		if (my_signal_name[k]=='-')
-			my_signal_name[k]='_';
+
+	for (k = 0; k < strlen(my_signal_name); k++) {
+		if (my_signal_name[k] == '-')
+			my_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;
-	
-	modified_signal_name = 
-		g_strconcat("signal_", 
-			    my_signal_name, NULL);
-	
-	seed_value_set_property(object_ref, 
-				modified_signal_name,
-				signal_ref);				
+
+	modified_signal_name = g_strconcat("signal_", my_signal_name, NULL);
+
+	seed_value_set_property(object_ref, modified_signal_name, signal_ref);
 	g_free(my_signal_name);
 	g_free(modified_signal_name);
 }
 
 static void seed_add_signals_for_type(JSObjectRef object_ref,
-									  GObject * obj,
-									  GType type)
+				      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)
-				{
-						seed_add_signal_to_object(object_ref, 
-												  obj,
-												  &query);
-				}
+	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) {
+			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)
+void seed_add_signals_to_object(JSObjectRef object_ref, GObject * obj)
 {
 	GType type;
-	GType * interfaces;
-	guint n,i;
+	GType *interfaces;
+	guint n, i;
 
 	g_assert(obj);
 
 	type = G_OBJECT_TYPE(obj);
-	while (type != 0)
-	{
-			seed_add_signals_for_type(object_ref, obj, type);
-			
-			interfaces = g_type_interfaces(type, &n);
-			for (i = 0; i < n; i++)
-					seed_add_signals_for_type(object_ref, obj, interfaces[i]);
-			
-			type = g_type_parent(type);
-			
-			g_free(interfaces);
+	while (type != 0) {
+		seed_add_signals_for_type(object_ref, obj, type);
+
+		interfaces = g_type_interfaces(type, &n);
+		for (i = 0; i < n; i++)
+			seed_add_signals_for_type(object_ref, obj,
+						  interfaces[i]);
+
+		type = g_type_parent(type);
+
+		g_free(interfaces);
 	}
 }
 
 static void
-seed_signal_marshal_func (GClosure * closure,
-			  GValue *return_value,
-			  guint n_param_values,
-			  const GValue *param_values,
-			  gpointer invocation_hint,
-			  gpointer marshall_data)
+seed_signal_marshal_func(GClosure * closure,
+			 GValue * return_value,
+			 guint n_param_values,
+			 const GValue * param_values,
+			 gpointer invocation_hint, gpointer marshall_data)
 {
-	SeedClosure *seed_closure = (SeedClosure *)closure;
-	JSValueRef * args;
+	SeedClosure *seed_closure = (SeedClosure *) closure;
+	JSValueRef *args;
 	int i;
 
 	args = g_newa(JSValueRef, n_param_values);
-	
-	for (i = 0; i < n_param_values; i++)
-	{
-		args[i] = seed_value_from_gvalue((GValue *)&param_values[i]);
+
+	for (i = 0; i < n_param_values; i++) {
+		args[i] = seed_value_from_gvalue((GValue *) & param_values[i]);
 
 		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));
-				
+
 	}
-	
-	JSObjectCallAsFunction(eng->context, seed_closure->function, 
-			       seed_closure->this,
-			       n_param_values, args, 0);
+
+	JSObjectCallAsFunction(eng->context, seed_closure->function,
+			       seed_closure->this, n_param_values, args, 0);
 }
 
 static JSValueRef
-seed_gobject_signal_connect (JSContextRef ctx,
-			     JSObjectRef function,
-			     JSObjectRef thisObject,
-			     size_t argumentCount,
-			     const JSValueRef arguments[],
-			     JSValueRef * exception)
-{
-	signal_privates * privates;
-	GClosure * closure;
-	
-	privates = (signal_privates *)JSObjectGetPrivate(thisObject);
+seed_gobject_signal_connect(JSContextRef ctx,
+			    JSObjectRef function,
+			    JSObjectRef thisObject,
+			    size_t argumentCount,
+			    const JSValueRef arguments[],
+			    JSValueRef * exception)
+{
+	signal_privates *privates;
+	GClosure *closure;
+
+	privates = (signal_privates *) JSObjectGetPrivate(thisObject);
 	if (!privates)
 		g_error("Signal constructed with invalid parameters"
 			"in namespace import \n");
 
 	g_assert((argumentCount <= 2));
-	
-	closure = g_closure_new_simple (sizeof(SeedClosure), 0);
+
+	closure = g_closure_new_simple(sizeof(SeedClosure), 0);
 	g_closure_set_marshal(closure, seed_signal_marshal_func);
 	//Losing a ref here. Fix please.
 	//g_closure_add_finalize_notifier(closure, NULL, NULL);
-	((SeedClosure *) closure)->function = (JSObjectRef)arguments[0];
-	((SeedClosure *)closure)->object = 
-		g_object_get_data(privates->object, "js-ref");
-	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;
-	
-
-	JSValueProtect(eng->context, (JSObjectRef)arguments[0]);
-	
-	
-	g_signal_connect_closure_by_id (privates->object,
-					privates->signal_id,
-					0,
-					closure,
-					FALSE);
+	((SeedClosure *) closure)->function = (JSObjectRef) arguments[0];
+	((SeedClosure *) closure)->object =
+	    g_object_get_data(privates->object, "js-ref");
+	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;
+
+	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},
- { 0, 0, 0}};
+    { {"connect", seed_gobject_signal_connect, 0}
+,
+{0, 0, 0}
+};
 
 JSClassDefinition gobject_signal_def = {
-	0, /* Version, always 0 */
+	0,			/* Version, always 0 */
 	kJSClassAttributeNoAutomaticPrototype,
-	"gobject_signal", /* Class Name */
-	NULL, /* Parent Class */
-	NULL, /* Static Values */
-	signal_static_functions, /* Static Functions */
+	"gobject_signal",	/* Class Name */
+	NULL,			/* Parent Class */
+	NULL,			/* Static Values */
+	signal_static_functions,	/* 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 */
+	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 * seed_get_signal_class(void)
+JSClassDefinition *seed_get_signal_class(void)
 {
 	return &gobject_signal_def;
 }
-
-
-
-

Modified: trunk/libseed/seed-signals.h
==============================================================================
--- trunk/libseed/seed-signals.h	(original)
+++ trunk/libseed/seed-signals.h	Tue Nov  4 05:43:44 2008
@@ -17,14 +17,13 @@
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-
 #ifndef _SEED_SIGNALS_H
 #define _SEED_SIGNALS_H
 
 #include "seed-private.h"
 
-void seed_add_signals_to_object(JSObjectRef object_ref, GObject *obj);
-JSClassDefinition * seed_get_signal_class(void);
+void seed_add_signals_to_object(JSObjectRef object_ref, GObject * obj);
+JSClassDefinition *seed_get_signal_class(void);
 extern JSClassRef gobject_signal_class;
 
 #endif

Modified: trunk/libseed/seed-structs.c
==============================================================================
--- trunk/libseed/seed-structs.c	(original)
+++ trunk/libseed/seed-structs.c	Tue Nov  4 05:43:44 2008
@@ -17,95 +17,83 @@
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-
 #include "seed-private.h"
 #include <string.h>
 JSClassRef seed_struct_class = 0;
 
-
 JSClassDefinition gobject_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 */
-		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_struct",		/* Class Name */
+	NULL,			/* Parent Class */
+	NULL,			/* Static Values */
+	NULL,			/* Static Functions */
+	NULL,
+	NULL,
+	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_struct_get_pointer(JSValueRef strukt)
 {
 	if (JSValueIsObjectOfClass(eng->context, strukt, seed_struct_class))
-		return JSObjectGetPrivate((JSObjectRef)strukt);
+		return JSObjectGetPrivate((JSObjectRef) strukt);
 	return 0;
 }
 
-JSObjectRef seed_make_union(gpointer younion, GIBaseInfo *info)
+JSObjectRef seed_make_union(gpointer younion, GIBaseInfo * info)
 {
-		JSObjectRef object;
-		int i, n_methods;
-		
-		if (!seed_struct_class)
-				seed_struct_class = JSClassCreate(&gobject_struct_def);
-		
-		object = JSObjectMake(eng->context, seed_struct_class, younion);
-		
-		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);
-				}
+	JSObjectRef object;
+	int i, n_methods;
+
+	if (!seed_struct_class)
+		seed_struct_class = JSClassCreate(&gobject_struct_def);
+
+	object = JSObjectMake(eng->context, seed_struct_class, younion);
+
+	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_struct(gpointer strukt, GIBaseInfo *info)
+JSObjectRef seed_make_struct(gpointer strukt, GIBaseInfo * info)
 {
-		JSObjectRef object;
-		int i, n_methods;
-		
-		if (!seed_struct_class)
-				seed_struct_class = JSClassCreate(&gobject_struct_def);
-		
-		object = JSObjectMake(eng->context, seed_struct_class, strukt);
-		
-		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);
-				}
+	JSObjectRef object;
+	int i, n_methods;
+
+	if (!seed_struct_class)
+		seed_struct_class = JSClassCreate(&gobject_struct_def);
+
+	object = JSObjectMake(eng->context, seed_struct_class, strukt);
+
+	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;
 }

Modified: trunk/libseed/seed-structs.h
==============================================================================
--- trunk/libseed/seed-structs.h	(original)
+++ trunk/libseed/seed-structs.h	Tue Nov  4 05:43:44 2008
@@ -20,8 +20,8 @@
 #ifndef _SEED_STRUCT_H
 #define _SEED_STRUCT_H
 
-JSObjectRef seed_make_union(gpointer younion, GIBaseInfo *info);
-JSObjectRef seed_make_struct(gpointer strukt, GIBaseInfo *info);
+JSObjectRef seed_make_union(gpointer younion, GIBaseInfo * info);
+JSObjectRef seed_make_struct(gpointer strukt, GIBaseInfo * info);
 gpointer seed_struct_get_pointer(JSValueRef strukt);
 
 #endif

Modified: trunk/libseed/seed-types.c
==============================================================================
--- trunk/libseed/seed-types.c	(original)
+++ trunk/libseed/seed-types.c	Tue Nov  4 05:43:44 2008
@@ -17,7 +17,6 @@
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-
 #include "seed-private.h"
 #include <string.h>
 #include <dlfcn.h>
@@ -25,469 +24,434 @@
 JSClassRef gobject_class;
 JSClassRef gobject_method_class;
 JSClassRef gobject_constructor_class;
-SeedEngine * eng;
+SeedEngine *eng;
 
 static gboolean seed_value_is_gobject(SeedValue value)
 {
-		if (!JSValueIsObject(eng->context, value) ||
-			JSValueIsNull(eng->context, value))
-			
-				return FALSE;
-	
-		return JSValueIsObjectOfClass(eng->context, value, gobject_class);
-}
+	if (!JSValueIsObject(eng->context, value) ||
+	    JSValueIsNull(eng->context, value))
+
+		return FALSE;
 
+	return JSValueIsObjectOfClass(eng->context, value, gobject_class);
+}
 
 static SeedValue seed_wrap_object(GObject * object)
 {
-		SeedValue user_data;
-		SeedValue js_ref;
-		JSClassRef class;
-		GType type, *interfaces;
-		JSValueRef prototype;
-		guint i, n;
-	
-
-		type = G_OBJECT_TYPE(object);
-
-		user_data = (SeedValue)g_object_get_data(object,
-												 "js-ref");
-	
-		if (user_data)
-				return user_data;
+	SeedValue user_data;
+	SeedValue js_ref;
+	JSClassRef class;
+	GType type, *interfaces;
+	JSValueRef prototype;
+	guint i, n;
 
-		class = seed_gobject_get_class_for_gtype(type);
+	type = G_OBJECT_TYPE(object);
 
+	user_data = (SeedValue) g_object_get_data(object, "js-ref");
 
-		while (!class && (type=g_type_parent(type)))
-		{
-				class = seed_gobject_get_class_for_gtype(type);
-		}
+	if (user_data)
+		return user_data;
 
-		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
-		{
-				interfaces = g_type_interfaces(G_OBJECT_TYPE(object), &n);
-				for (i = 0; i < n; i++)
-				{
-						GIFunctionInfo * function;
-						GIBaseInfo * interface;
-						gint n_functions, k;
-						
-						interface = g_irepository_find_by_gtype(0,
-																interfaces[i]);
-						
-						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,
-																				(JSObjectRef)js_ref, TRUE);
-						}
-				}
+	class = seed_gobject_get_class_for_gtype(type);
+
+	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 {
+		interfaces = g_type_interfaces(G_OBJECT_TYPE(object), &n);
+		for (i = 0; i < n; i++) {
+			GIFunctionInfo *function;
+			GIBaseInfo *interface;
+			gint n_functions, k;
+
+			interface = g_irepository_find_by_gtype(0,
+								interfaces[i]);
+
+			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, (JSObjectRef) js_ref, TRUE);
+			}
 		}
+	}
+
+	object = g_object_ref_sink(object);
+
+	return js_ref;
+}
 
-		object = g_object_ref_sink(object);
-	
-		return js_ref;
-}
-
-GType seed_gi_type_to_gtype(GITypeInfo *type_info, GITypeTag tag)
-{
-		switch(tag)
-		{
-		case GI_TYPE_TAG_VOID:
-				return G_TYPE_NONE;
-		case GI_TYPE_TAG_BOOLEAN:
-				return G_TYPE_BOOLEAN;
-		case GI_TYPE_TAG_INT8:
-				return G_TYPE_CHAR;
-		case GI_TYPE_TAG_UINT8:
-				return G_TYPE_UCHAR;
-		case GI_TYPE_TAG_INT16:
-				return G_TYPE_INT;
-		case GI_TYPE_TAG_UINT16:
-				return G_TYPE_UINT;
-		case GI_TYPE_TAG_INT32:
-				return G_TYPE_INT;
-		case GI_TYPE_TAG_UINT32:
-				return G_TYPE_UINT;
-		case GI_TYPE_TAG_INT64:
-				return G_TYPE_INT64;
-		case GI_TYPE_TAG_UINT64:
-				return G_TYPE_UINT64;
-		case GI_TYPE_TAG_INT:
-				return G_TYPE_INT;
-		case GI_TYPE_TAG_UINT:
-				return G_TYPE_UINT;
-		case GI_TYPE_TAG_LONG:
+GType seed_gi_type_to_gtype(GITypeInfo * type_info, GITypeTag tag)
+{
+	switch (tag) {
+	case GI_TYPE_TAG_VOID:
+		return G_TYPE_NONE;
+	case GI_TYPE_TAG_BOOLEAN:
+		return G_TYPE_BOOLEAN;
+	case GI_TYPE_TAG_INT8:
+		return G_TYPE_CHAR;
+	case GI_TYPE_TAG_UINT8:
+		return G_TYPE_UCHAR;
+	case GI_TYPE_TAG_INT16:
+		return G_TYPE_INT;
+	case GI_TYPE_TAG_UINT16:
+		return G_TYPE_UINT;
+	case GI_TYPE_TAG_INT32:
+		return G_TYPE_INT;
+	case GI_TYPE_TAG_UINT32:
+		return G_TYPE_UINT;
+	case GI_TYPE_TAG_INT64:
+		return G_TYPE_INT64;
+	case GI_TYPE_TAG_UINT64:
+		return G_TYPE_UINT64;
+	case GI_TYPE_TAG_INT:
+		return G_TYPE_INT;
+	case GI_TYPE_TAG_UINT:
+		return G_TYPE_UINT;
+	case GI_TYPE_TAG_LONG:
+		return G_TYPE_LONG;
+	case GI_TYPE_TAG_ULONG:
+		return G_TYPE_ULONG;
+	case GI_TYPE_TAG_SSIZE:
+		return G_TYPE_INT;
+	case GI_TYPE_TAG_SIZE:
+		return G_TYPE_INT;
+	case GI_TYPE_TAG_FLOAT:
+		return G_TYPE_FLOAT;
+	case GI_TYPE_TAG_DOUBLE:
+		return G_TYPE_DOUBLE;
+	case GI_TYPE_TAG_UTF8:
+	case GI_TYPE_TAG_FILENAME:
+		return G_TYPE_STRING;
+	case GI_TYPE_TAG_ARRAY:
+	case GI_TYPE_TAG_GLIST:
+	case GI_TYPE_TAG_GSLIST:
+	case GI_TYPE_TAG_GHASH:
+	case GI_TYPE_TAG_ERROR:
+	case GI_TYPE_TAG_TIME_T:
+	case GI_TYPE_TAG_GTYPE:
+		return G_TYPE_INVALID;
+	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)
+				return G_TYPE_OBJECT;
+			else if (interface_type == GI_INFO_TYPE_ENUM)
 				return G_TYPE_LONG;
-		case GI_TYPE_TAG_ULONG:
-				return G_TYPE_ULONG;
-		case GI_TYPE_TAG_SSIZE:
-				return G_TYPE_INT;
-		case GI_TYPE_TAG_SIZE:
-				return G_TYPE_INT;
-		case GI_TYPE_TAG_FLOAT:
-				return G_TYPE_FLOAT;
-		case GI_TYPE_TAG_DOUBLE:
-				return G_TYPE_DOUBLE;
-		case GI_TYPE_TAG_UTF8:
-		case GI_TYPE_TAG_FILENAME:
-				return G_TYPE_STRING;
-		case GI_TYPE_TAG_ARRAY:
-		case GI_TYPE_TAG_GLIST:
-		case GI_TYPE_TAG_GSLIST:
-		case GI_TYPE_TAG_GHASH:
-		case GI_TYPE_TAG_ERROR:
-		case GI_TYPE_TAG_TIME_T:
-		case GI_TYPE_TAG_GTYPE:
-				return G_TYPE_INVALID;
-		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)
-						return G_TYPE_OBJECT;
-				else if (interface_type == GI_INFO_TYPE_ENUM)
-						return G_TYPE_LONG;
-				else if (interface_type == GI_INFO_TYPE_STRUCT)
-						return G_TYPE_POINTER;
+			else if (interface_type == GI_INFO_TYPE_STRUCT)
+				return G_TYPE_POINTER;
 		}
-		}
-		return 0;
+	}
+	return 0;
 }
 
-
 gboolean seed_gi_make_argument(SeedValue value,
-							   GITypeInfo * type_info,
-							   GArgument * arg)
+			       GITypeInfo * type_info, GArgument * arg)
 {
-		GITypeTag gi_tag = g_type_info_get_tag(type_info);
+	GITypeTag gi_tag = g_type_info_get_tag(type_info);
 
-	
-		if (!value || JSValueIsNull(eng->context, value))
-		{
-				arg->v_pointer = 0;
-				return 1;
-		}
+	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);
-				break;
-		case GI_TYPE_TAG_INT8:
-				arg->v_int8 = seed_value_to_char(value);
-				break;
-		case GI_TYPE_TAG_UINT8:
-				arg->v_uint8 = seed_value_to_uchar(value);
-				break;
-		case GI_TYPE_TAG_INT16:
-				arg->v_int16 = seed_value_to_int(value);
-				break;
-		case GI_TYPE_TAG_UINT16:
-				arg->v_uint16 = seed_value_to_uint(value);
-				break;
-		case GI_TYPE_TAG_INT32:
-				arg->v_int32 = seed_value_to_int(value);
-				break;
-		case GI_TYPE_TAG_UINT32:
-				arg->v_uint32 = seed_value_to_uint(value);
-				break;
-		case GI_TYPE_TAG_LONG:
-		case GI_TYPE_TAG_INT64:
-				arg->v_int64 = seed_value_to_long(value);
-				break;
-		case GI_TYPE_TAG_ULONG:
-		case GI_TYPE_TAG_UINT64:
-				arg->v_uint64 = seed_value_to_ulong(value);
-				break;
-		case GI_TYPE_TAG_INT:
-				arg->v_int = seed_value_to_int(value);
-				break;
-		case GI_TYPE_TAG_UINT:
-				arg->v_uint = seed_value_to_uint(value);
-				break;
-		case GI_TYPE_TAG_SIZE:
-		case GI_TYPE_TAG_SSIZE:
-				arg->v_int = seed_value_to_int(value);
-				break;
-		case GI_TYPE_TAG_FLOAT:
-				arg->v_float = seed_value_to_float(value);
-				break;
-		case GI_TYPE_TAG_DOUBLE:
-				arg->v_double = seed_value_to_double(value);
-				break;
-		case GI_TYPE_TAG_UTF8:
-				arg->v_string = seed_value_to_string(value);
-				break;
-		case GI_TYPE_TAG_INTERFACE:
+	switch (gi_tag) {
+	case GI_TYPE_TAG_VOID:
+		break;
+	case GI_TYPE_TAG_BOOLEAN:
+		arg->v_boolean = seed_value_to_boolean(value);
+		break;
+	case GI_TYPE_TAG_INT8:
+		arg->v_int8 = seed_value_to_char(value);
+		break;
+	case GI_TYPE_TAG_UINT8:
+		arg->v_uint8 = seed_value_to_uchar(value);
+		break;
+	case GI_TYPE_TAG_INT16:
+		arg->v_int16 = seed_value_to_int(value);
+		break;
+	case GI_TYPE_TAG_UINT16:
+		arg->v_uint16 = seed_value_to_uint(value);
+		break;
+	case GI_TYPE_TAG_INT32:
+		arg->v_int32 = seed_value_to_int(value);
+		break;
+	case GI_TYPE_TAG_UINT32:
+		arg->v_uint32 = seed_value_to_uint(value);
+		break;
+	case GI_TYPE_TAG_LONG:
+	case GI_TYPE_TAG_INT64:
+		arg->v_int64 = seed_value_to_long(value);
+		break;
+	case GI_TYPE_TAG_ULONG:
+	case GI_TYPE_TAG_UINT64:
+		arg->v_uint64 = seed_value_to_ulong(value);
+		break;
+	case GI_TYPE_TAG_INT:
+		arg->v_int = seed_value_to_int(value);
+		break;
+	case GI_TYPE_TAG_UINT:
+		arg->v_uint = seed_value_to_uint(value);
+		break;
+	case GI_TYPE_TAG_SIZE:
+	case GI_TYPE_TAG_SSIZE:
+		arg->v_int = seed_value_to_int(value);
+		break;
+	case GI_TYPE_TAG_FLOAT:
+		arg->v_float = seed_value_to_float(value);
+		break;
+	case GI_TYPE_TAG_DOUBLE:
+		arg->v_double = seed_value_to_double(value);
+		break;
+	case GI_TYPE_TAG_UTF8:
+		arg->v_string = seed_value_to_string(value);
+		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);
-						required_gtype = 
-								g_registered_type_info_get_g_type(
-										(GIRegisteredTypeInfo *) interface);
-						if (!gobject || !g_type_is_a(G_OBJECT_TYPE (gobject), 
-										 required_gtype))
-						{
-								return FALSE;
-						}
-			
-						arg->v_pointer = g_object_ref(gobject);
-						break;
-				}
-				else if (interface_type == GI_INFO_TYPE_ENUM)
-				{
-						arg->v_long = JSValueToNumber(eng->context, 
-													  value, NULL);
-						break;
-				}
-				else if (interface_type == GI_INFO_TYPE_STRUCT)
-				{
-						arg->v_pointer = seed_struct_get_pointer(value);
-						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);
+
+			arg->v_pointer = NULL;
+
+			if (interface_type == GI_INFO_TYPE_OBJECT
+			    || interface_type == GI_INFO_TYPE_INTERFACE) {
+				gobject = seed_value_to_object(value);
+				required_gtype =
+				    g_registered_type_info_get_g_type((GIRegisteredTypeInfo *) interface);
+				if (!gobject
+				    || !g_type_is_a(G_OBJECT_TYPE(gobject),
+						    required_gtype)) {
+					return FALSE;
 				}
-				else if (interface_type == GI_INFO_TYPE_CALLBACK)
-				{
-						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;
-								break;
-						}
 
+				arg->v_pointer = g_object_ref(gobject);
+				break;
+			} else if (interface_type == GI_INFO_TYPE_ENUM) {
+				arg->v_long = JSValueToNumber(eng->context,
+							      value, NULL);
+				break;
+			} else if (interface_type == GI_INFO_TYPE_STRUCT) {
+				arg->v_pointer = seed_struct_get_pointer(value);
+				break;
+			} else if (interface_type == GI_INFO_TYPE_CALLBACK) {
+				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;
+					break;
 				}
+
+			}
 		}
-	  
-		default:
-				return FALSE;
-
-	      
-		
-		
-		}
-		return TRUE;
-		
+
+	default:
+		return FALSE;
+
+	}
+	return TRUE;
+
 }
 
 JSValueRef seed_gi_argument_make_js(GArgument * arg, GITypeInfo * type_info)
 {
-		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);
-		case GI_TYPE_TAG_INT8:
-				return seed_value_from_char(arg->v_int8);
-		case GI_TYPE_TAG_UINT8:
-				return seed_value_from_uchar(arg->v_uint8);
-		case GI_TYPE_TAG_INT16:
-				return seed_value_from_int(arg->v_int16);
-		case GI_TYPE_TAG_UINT16:
-				return seed_value_from_uint(arg->v_uint16);
-		case GI_TYPE_TAG_INT32:
-				return seed_value_from_int(arg->v_int32);
-		case GI_TYPE_TAG_UINT32:
-				return seed_value_from_uint(arg->v_uint32);
-		case GI_TYPE_TAG_LONG:
-		case GI_TYPE_TAG_INT64:
-				return seed_value_from_long(arg->v_int64);
-		case GI_TYPE_TAG_ULONG:
-		case GI_TYPE_TAG_UINT64:
-				return seed_value_from_ulong(arg->v_uint64);
-		case GI_TYPE_TAG_INT:
-				return seed_value_from_int(arg->v_int32);
-		case GI_TYPE_TAG_UINT:
-				return seed_value_from_uint(arg->v_uint32);
-		case GI_TYPE_TAG_SSIZE:
-		case GI_TYPE_TAG_SIZE:
-				return seed_value_from_int(arg->v_int);
-		case GI_TYPE_TAG_FLOAT:
-				return seed_value_from_float(arg->v_float);
-		case GI_TYPE_TAG_DOUBLE:
-				return seed_value_from_double(arg->v_double);
-		case GI_TYPE_TAG_UTF8:
-				return seed_value_from_string(arg->v_string);
-		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)
-						{
-								return JSValueMakeNull(eng->context);
-						}
-						return seed_value_from_object(arg->v_pointer);
-				}
-				else if (interface_type == GI_INFO_TYPE_ENUM)
-				{
-						return seed_value_from_double(arg->v_double);
-				}
-				else if (interface_type == GI_INFO_TYPE_STRUCT)
-				{
-						return seed_make_struct(arg->v_pointer, 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);
+	case GI_TYPE_TAG_INT8:
+		return seed_value_from_char(arg->v_int8);
+	case GI_TYPE_TAG_UINT8:
+		return seed_value_from_uchar(arg->v_uint8);
+	case GI_TYPE_TAG_INT16:
+		return seed_value_from_int(arg->v_int16);
+	case GI_TYPE_TAG_UINT16:
+		return seed_value_from_uint(arg->v_uint16);
+	case GI_TYPE_TAG_INT32:
+		return seed_value_from_int(arg->v_int32);
+	case GI_TYPE_TAG_UINT32:
+		return seed_value_from_uint(arg->v_uint32);
+	case GI_TYPE_TAG_LONG:
+	case GI_TYPE_TAG_INT64:
+		return seed_value_from_long(arg->v_int64);
+	case GI_TYPE_TAG_ULONG:
+	case GI_TYPE_TAG_UINT64:
+		return seed_value_from_ulong(arg->v_uint64);
+	case GI_TYPE_TAG_INT:
+		return seed_value_from_int(arg->v_int32);
+	case GI_TYPE_TAG_UINT:
+		return seed_value_from_uint(arg->v_uint32);
+	case GI_TYPE_TAG_SSIZE:
+	case GI_TYPE_TAG_SIZE:
+		return seed_value_from_int(arg->v_int);
+	case GI_TYPE_TAG_FLOAT:
+		return seed_value_from_float(arg->v_float);
+	case GI_TYPE_TAG_DOUBLE:
+		return seed_value_from_double(arg->v_double);
+	case GI_TYPE_TAG_UTF8:
+		return seed_value_from_string(arg->v_string);
+	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) {
+					return JSValueMakeNull(eng->context);
 				}
+				return seed_value_from_object(arg->v_pointer);
+			} else if (interface_type == GI_INFO_TYPE_ENUM) {
+				return seed_value_from_double(arg->v_double);
+			} else if (interface_type == GI_INFO_TYPE_STRUCT) {
+				return seed_make_struct(arg->v_pointer,
+							interface);
+			}
 		}
-		case GI_TYPE_TAG_GLIST:
+	case GI_TYPE_TAG_GLIST:
 		{
-				GIBaseInfo *interface;
-				GITypeInfo * list_type;
-				JSObjectRef ret;
-				GArgument larg;
-				int 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;
+			GIBaseInfo *interface;
+			GITypeInfo *list_type;
+			JSObjectRef ret;
+			GArgument larg;
+			int 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);
+				JSObjectSetPropertyAtIndex(eng->context, ret, i,
+							   ival, NULL);
+				i++;
+			}
+			return ret;
 
-						larg.v_pointer = list->data;
-						ival = 
-						 (JSValueRef)seed_gi_argument_make_js(&larg, list_type);
-						JSObjectSetPropertyAtIndex(eng->context, 
-												   ret, i,
-												   ival, NULL);
-						i++;
-				}
-				return ret;				
-				
 		}
-		case GI_TYPE_TAG_GSLIST:
+	case GI_TYPE_TAG_GSLIST:
 		{
-				
-				GIBaseInfo *interface;
-				GITypeInfo * list_type;
-				JSObjectRef ret;
-				GArgument larg;
-				int 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);
-						JSObjectSetPropertyAtIndex(eng->context, 
-												   ret, i,
-												   ival, NULL);
-						i++;
-				}
-				return ret;				
-		}
-	  
-		default:
-				return FALSE;
+			GIBaseInfo *interface;
+			GITypeInfo *list_type;
+			JSObjectRef ret;
+			GArgument larg;
+			int 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);
+				JSObjectSetPropertyAtIndex(eng->context, ret, i,
+							   ival, NULL);
+				i++;
+			}
+			return ret;
 		}
-		return 0;
+
+	default:
+		return FALSE;
+
+	}
+	return 0;
 }
 
 gboolean seed_gi_supports_type(GITypeInfo * type_info)
 {
-		GITypeTag type_tag;
-	
-		type_tag = g_type_info_get_tag(type_info);
-	
-		switch (type_tag)
-		{
-		case GI_TYPE_TAG_VOID:
-		case GI_TYPE_TAG_BOOLEAN:
-		case GI_TYPE_TAG_INT8:
-		case GI_TYPE_TAG_UINT8:
-		case GI_TYPE_TAG_INT16:
-		case GI_TYPE_TAG_UINT16:
-		case GI_TYPE_TAG_INT32:
-		case GI_TYPE_TAG_UINT32:
-		case GI_TYPE_TAG_INT64:
-		case GI_TYPE_TAG_UINT64:
-		case GI_TYPE_TAG_INT:
-		case GI_TYPE_TAG_UINT:
-		case GI_TYPE_TAG_LONG:
-		case GI_TYPE_TAG_ULONG:
-		case GI_TYPE_TAG_SSIZE:
-		case GI_TYPE_TAG_SIZE:
-		case GI_TYPE_TAG_FLOAT:
-		case GI_TYPE_TAG_DOUBLE:
-		case GI_TYPE_TAG_UTF8:
-		case GI_TYPE_TAG_INTERFACE:
-				return TRUE;
-	       
-		case GI_TYPE_TAG_FILENAME:
-		case GI_TYPE_TAG_ARRAY:
-		case GI_TYPE_TAG_GLIST:
-		case GI_TYPE_TAG_GSLIST:
-		case GI_TYPE_TAG_GHASH:
-		case GI_TYPE_TAG_ERROR:
-			// We should support time_t easily.
-		case GI_TYPE_TAG_TIME_T:
-		case GI_TYPE_TAG_GTYPE:
-				return FALSE;
-		
-	
-		}
+	GITypeTag type_tag;
+
+	type_tag = g_type_info_get_tag(type_info);
+
+	switch (type_tag) {
+	case GI_TYPE_TAG_VOID:
+	case GI_TYPE_TAG_BOOLEAN:
+	case GI_TYPE_TAG_INT8:
+	case GI_TYPE_TAG_UINT8:
+	case GI_TYPE_TAG_INT16:
+	case GI_TYPE_TAG_UINT16:
+	case GI_TYPE_TAG_INT32:
+	case GI_TYPE_TAG_UINT32:
+	case GI_TYPE_TAG_INT64:
+	case GI_TYPE_TAG_UINT64:
+	case GI_TYPE_TAG_INT:
+	case GI_TYPE_TAG_UINT:
+	case GI_TYPE_TAG_LONG:
+	case GI_TYPE_TAG_ULONG:
+	case GI_TYPE_TAG_SSIZE:
+	case GI_TYPE_TAG_SIZE:
+	case GI_TYPE_TAG_FLOAT:
+	case GI_TYPE_TAG_DOUBLE:
+	case GI_TYPE_TAG_UTF8:
+	case GI_TYPE_TAG_INTERFACE:
+		return TRUE;
+
+	case GI_TYPE_TAG_FILENAME:
+	case GI_TYPE_TAG_ARRAY:
+	case GI_TYPE_TAG_GLIST:
+	case GI_TYPE_TAG_GSLIST:
+	case GI_TYPE_TAG_GHASH:
+	case GI_TYPE_TAG_ERROR:
+		// We should support time_t easily.
+	case GI_TYPE_TAG_TIME_T:
+	case GI_TYPE_TAG_GTYPE:
 		return FALSE;
+
+	}
+	return FALSE;
 }
 
 SeedValue seed_value_from_gvalue(GValue * gval)
 {
-	if(!G_IS_VALUE(gval))
-	{
+	if (!G_IS_VALUE(gval)) {
 		return false;
 	}
-	switch(G_VALUE_TYPE(gval))
-	{
+	switch (G_VALUE_TYPE(gval)) {
 	case G_TYPE_BOOLEAN:
 		return seed_value_from_boolean(g_value_get_boolean(gval));
 	case G_TYPE_CHAR:
@@ -511,236 +475,223 @@
 	case G_TYPE_DOUBLE:
 		return seed_value_from_double(g_value_get_double(gval));
 	case G_TYPE_STRING:
-		return seed_value_from_string((gchar*)g_value_get_string(gval));
+		return seed_value_from_string((gchar *)
+					      g_value_get_string(gval));
 	case G_TYPE_POINTER:
 		return seed_make_struct(g_value_get_pointer(gval), 0);
 	}
-	
-	if(g_type_is_a(G_VALUE_TYPE(gval), G_TYPE_ENUM))
+
+	if (g_type_is_a(G_VALUE_TYPE(gval), G_TYPE_ENUM))
 		return seed_value_from_long(gval->data[0].v_long);
-	else if(g_type_is_a(G_VALUE_TYPE(gval), G_TYPE_ENUM))
+	else if (g_type_is_a(G_VALUE_TYPE(gval), G_TYPE_ENUM))
 		return seed_value_from_long(gval->data[0].v_long);
-	else if(g_type_is_a(G_VALUE_TYPE(gval), G_TYPE_OBJECT))
-	{
+	else if (g_type_is_a(G_VALUE_TYPE(gval), G_TYPE_OBJECT)) {
 		// TODO: check for leaks
 		return seed_value_from_object(g_value_get_object(gval));
-	}
-	else
-	{
-		GIBaseInfo * info;
+	} else {
+		GIBaseInfo *info;
 		GIInfoType type;
-		
+
 		info = g_irepository_find_by_gtype(0, G_VALUE_TYPE(gval));
 		type = g_base_info_get_type(info);
-		
-		if (type == GI_INFO_TYPE_UNION)
-		{
-				return seed_make_union(g_value_peek_pointer(gval), 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) {
+			printf("Trying to marshal boxed type \n");
 		}
-		else if (type == GI_INFO_TYPE_STRUCT)
-		{
-				return seed_make_struct(g_value_peek_pointer(gval), info);
-									
-		}
-		else if (type == GI_INFO_TYPE_BOXED)
-		{
-				printf("Trying to marshal boxed type \n");
-		}
-			
+
 	}
 
 	return NULL;
 }
 
-gboolean seed_gvalue_from_seed_value(SeedValue val, 
-									 GType type,
-									 GValue * ret)
-	
+gboolean seed_gvalue_from_seed_value(SeedValue val, GType type, GValue * ret)
 {
-	switch(type)
-	{
+	switch (type) {
 	case G_TYPE_BOOLEAN:
-	{
-		/* This is fail. Need to call
-		   seed_gvalue_from_seed_value with no type, and then
-		   try gobject cast. */
-		//if(!JSValueIsBoolean(eng->context, val))
-		//		goto bad_type;
+		{
+			/* This is fail. Need to call
+			   seed_gvalue_from_seed_value with no type, and then
+			   try gobject cast. */
+			//if(!JSValueIsBoolean(eng->context, val))
+			//              goto bad_type;
 
-		g_value_init(ret, G_TYPE_BOOLEAN);
-		g_value_set_boolean(ret, seed_value_to_boolean(val));
-		return TRUE;
-	}
+			g_value_init(ret, G_TYPE_BOOLEAN);
+			g_value_set_boolean(ret, seed_value_to_boolean(val));
+			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));
-		else
-			g_value_set_uint(ret, seed_value_to_uint(val));
-		return TRUE;
-	}
+		{
+			g_value_init(ret, type);
+			if (type == G_TYPE_INT)
+				g_value_set_int(ret, seed_value_to_int(val));
+			else
+				g_value_set_uint(ret, seed_value_to_uint(val));
+			return TRUE;
+		}
 	case G_TYPE_CHAR:
-	{
-		g_value_init(ret, G_TYPE_CHAR);
-		g_value_set_char(ret, seed_value_to_char(val));
-		return TRUE;
-	}
+		{
+			g_value_init(ret, G_TYPE_CHAR);
+			g_value_set_char(ret, seed_value_to_char(val));
+			return TRUE;
+		}
 	case G_TYPE_UCHAR:
-	{
-		g_value_init(ret, G_TYPE_UCHAR);
-		g_value_set_uchar(ret, seed_value_to_uchar(val));
-		return TRUE;
-	}
+		{
+			g_value_init(ret, G_TYPE_UCHAR);
+			g_value_set_uchar(ret, seed_value_to_uchar(val));
+			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));
-			break;
-		case G_TYPE_ULONG:
-			g_value_init(ret, G_TYPE_ULONG);
-			g_value_set_ulong(ret, seed_value_to_ulong(val));
-			break;
-		case G_TYPE_INT64:
-			g_value_init(ret, G_TYPE_INT64);
-			g_value_set_int64(ret, seed_value_to_int64(val));
-			break;
-		case G_TYPE_UINT64:
-			g_value_init(ret, G_TYPE_UINT64);
-			g_value_set_uint64(ret, seed_value_to_uint64(val));
-			break;
-		case G_TYPE_FLOAT:
-			g_value_init(ret, G_TYPE_FLOAT);
-			g_value_set_float(ret, seed_value_to_float(val));
-			break;
-		case G_TYPE_DOUBLE:
-			g_value_init(ret, G_TYPE_DOUBLE);
-			g_value_set_double(ret, seed_value_to_double(val));
-			break;
-		}
-		return TRUE;
-	}
-	case G_TYPE_STRING:
-	{
-		gchar * cval = seed_value_to_string(val);
-					
-		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));
-			return TRUE;
-		}
-		case kJSTypeNumber:
-		{
-			g_value_init(ret, G_TYPE_DOUBLE);
-			g_value_set_double(ret, seed_value_to_double(val));
+			switch (type) {
+			case G_TYPE_LONG:
+				g_value_init(ret, G_TYPE_LONG);
+				g_value_set_long(ret, seed_value_to_long(val));
+				break;
+			case G_TYPE_ULONG:
+				g_value_init(ret, G_TYPE_ULONG);
+				g_value_set_ulong(ret,
+						  seed_value_to_ulong(val));
+				break;
+			case G_TYPE_INT64:
+				g_value_init(ret, G_TYPE_INT64);
+				g_value_set_int64(ret,
+						  seed_value_to_int64(val));
+				break;
+			case G_TYPE_UINT64:
+				g_value_init(ret, G_TYPE_UINT64);
+				g_value_set_uint64(ret,
+						   seed_value_to_uint64(val));
+				break;
+			case G_TYPE_FLOAT:
+				g_value_init(ret, G_TYPE_FLOAT);
+				g_value_set_float(ret,
+						  seed_value_to_float(val));
+				break;
+			case G_TYPE_DOUBLE:
+				g_value_init(ret, G_TYPE_DOUBLE);
+				g_value_set_double(ret,
+						   seed_value_to_double(val));
+				break;
+			}
 			return TRUE;
 		}
-		case kJSTypeString:
+	case G_TYPE_STRING:
 		{
-			gchar * cv = seed_value_to_string(val);
+			gchar *cval = seed_value_to_string(val);
 
 			g_value_init(ret, G_TYPE_STRING);
-			g_value_take_string(ret, cv);
+			g_value_take_string(ret, cval);
+
 			return TRUE;
 		}
-		default:
+	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));
+					return TRUE;
+				}
+			case kJSTypeNumber:
+				{
+					g_value_init(ret, G_TYPE_DOUBLE);
+					g_value_set_double(ret,
+							   seed_value_to_double
+							   (val));
+					return TRUE;
+				}
+			case kJSTypeString:
+				{
+					gchar *cv = seed_value_to_string(val);
+
+					g_value_init(ret, G_TYPE_STRING);
+					g_value_take_string(ret, cv);
+					return TRUE;
+				}
+			default:
+				break;
+			}
 			break;
 		}
-		break;
-	}
 	}
 
-	if(g_type_is_a(type, G_TYPE_ENUM) && JSValueIsNumber(eng->context, val))
-	{
+	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);
 		return TRUE;
-	}
-	else if(g_type_is_a(type, G_TYPE_FLAGS)
-			&& JSValueIsNumber(eng->context, val))
-	{
+	} 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);
 		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);
+	} 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);
 
-		if(o == NULL || g_type_is_a(G_OBJECT_TYPE(o), type))
-		{
+		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;
 		}
 
 		g_object_unref(o);
-	}
-	else if(g_type_is_a(type, G_TYPE_BOXED))
-	{
-			gpointer p = seed_struct_get_pointer(val);
-			if (p)
-			{
-					g_value_init(ret, type);
-					g_value_set_boxed(ret, p);
-					return TRUE;
-			}
+	} else if (g_type_is_a(type, G_TYPE_BOXED)) {
+		gpointer p = seed_struct_get_pointer(val);
+		if (p) {
+			g_value_init(ret, type);
+			g_value_set_boxed(ret, p);
+			return TRUE;
+		}
 	}
 
 	return FALSE;
 }
 
-SeedValue seed_value_get_property(SeedValue val, 
-								  const char * name)
+SeedValue seed_value_get_property(SeedValue val, const char *name)
 {
-	
-		JSStringRef jname = JSStringCreateWithUTF8CString(name);
-		JSValueRef ret =  JSObjectGetProperty(eng->context, 
-											  (JSObjectRef)val, 
-											  jname, NULL);
-	
-		JSStringRelease(jname);
-	
-		return ret;
-}
-
-gboolean seed_value_set_property(JSObjectRef object, 
-								 const char * name, 
-								 JSValueRef value)
-{
-		JSStringRef jname = JSStringCreateWithUTF8CString(name);
-	
-		if (value)
-		{
-				JSObjectSetProperty(eng->context, (JSObjectRef)object, 
-									jname, value, 0, 0);
-		}
-	
-		JSStringRelease(jname);
-	
-		return TRUE;
+
+	JSStringRef jname = JSStringCreateWithUTF8CString(name);
+	JSValueRef ret = JSObjectGetProperty(eng->context,
+					     (JSObjectRef) val,
+					     jname, NULL);
+
+	JSStringRelease(jname);
+
+	return ret;
+}
+
+gboolean seed_value_set_property(JSObjectRef object,
+				 const char *name, JSValueRef value)
+{
+	JSStringRef jname = JSStringCreateWithUTF8CString(name);
+
+	if (value) {
+		JSObjectSetProperty(eng->context, (JSObjectRef) object,
+				    jname, value, 0, 0);
+	}
+
+	JSStringRelease(jname);
+
+	return TRUE;
 }
 
 static void seed_value_wrong_type()
@@ -749,283 +700,271 @@
 	abort();
 }
 
-gboolean	seed_value_to_boolean(JSValueRef val)
+gboolean seed_value_to_boolean(JSValueRef val)
 {
-	if(!JSValueIsBoolean(eng->context, val))
-	{
-		if(!JSValueIsNull(eng->context, val))
+	if (!JSValueIsBoolean(eng->context, val)) {
+		if (!JSValueIsNull(eng->context, val))
 			seed_value_wrong_type();
-			
+
 		seed_value_wrong_type();
 		return 0;
 	}
-	
+
 	return JSValueToBoolean(eng->context, val);
 }
 
-JSValueRef	seed_value_from_boolean(gboolean val)
+JSValueRef seed_value_from_boolean(gboolean val)
 {
 	return JSValueMakeBoolean(eng->context, val);
 }
 
-guint		seed_value_to_uint(JSValueRef val)
+guint seed_value_to_uint(JSValueRef val)
 {
-	if(!JSValueIsNumber(eng->context, val))
-	{
-		if(!JSValueIsNull(eng->context, val))
+	if (!JSValueIsNumber(eng->context, val)) {
+		if (!JSValueIsNull(eng->context, val))
 			seed_value_wrong_type();
 		return 0;
 	}
-	
-	return (guint)JSValueToNumber(eng->context, val, NULL);
+
+	return (guint) JSValueToNumber(eng->context, val, NULL);
 }
 
-JSValueRef	seed_value_from_uint(guint val)
+JSValueRef seed_value_from_uint(guint val)
 {
-	return JSValueMakeNumber(eng->context, (gdouble)val);
+	return JSValueMakeNumber(eng->context, (gdouble) val);
 }
 
-gint		seed_value_to_int(JSValueRef val)
+gint seed_value_to_int(JSValueRef val)
 {
-	if(!JSValueIsNumber(eng->context, val))
-	{
-		if(!JSValueIsNull(eng->context, val))
+	if (!JSValueIsNumber(eng->context, val)) {
+		if (!JSValueIsNull(eng->context, val))
 			seed_value_wrong_type();
 		return 0;
 	}
-	
-	return (gint)JSValueToNumber(eng->context, val, NULL);
+
+	return (gint) JSValueToNumber(eng->context, val, NULL);
 }
 
-JSValueRef	seed_value_from_int(gint val)
+JSValueRef seed_value_from_int(gint val)
 {
-	return JSValueMakeNumber(eng->context, (gdouble)val);
+	return JSValueMakeNumber(eng->context, (gdouble) val);
 }
 
-gchar		seed_value_to_char(JSValueRef val)
+gchar seed_value_to_char(JSValueRef val)
 {
 	int cv;
-	
-	if(!JSValueIsNumber(eng->context, val))
-	{
-		if(!JSValueIsNull(eng->context, val))
+
+	if (!JSValueIsNumber(eng->context, val)) {
+		if (!JSValueIsNull(eng->context, val))
 			seed_value_wrong_type();
 		return 0;
 	}
-	
+
 	cv = JSValueToNumber(eng->context, val, NULL);
-	
-	if(cv < G_MININT8 || cv > G_MAXINT8)
-	{
+
+	if (cv < G_MININT8 || cv > G_MAXINT8) {
 		seed_value_wrong_type();
 		return 0;
 	}
-	
+
 	return (char)cv;
 }
 
-JSValueRef	seed_value_from_char(gchar val)
+JSValueRef seed_value_from_char(gchar val)
 {
-	return JSValueMakeNumber(eng->context, (gdouble)val);
+	return JSValueMakeNumber(eng->context, (gdouble) val);
 }
 
-guchar		seed_value_to_uchar(JSValueRef val)
+guchar seed_value_to_uchar(JSValueRef val)
 {
 	guint cv;
-	
-	if(!JSValueIsNumber(eng->context, val))
-	{
-		if(!JSValueIsNull(eng->context, val))
+
+	if (!JSValueIsNumber(eng->context, val)) {
+		if (!JSValueIsNull(eng->context, val))
 			seed_value_wrong_type();
 		return 0;
 	}
-	
+
 	cv = JSValueToNumber(eng->context, val, NULL);
-	
-	if(cv > G_MAXUINT8)
-	{
+
+	if (cv > G_MAXUINT8) {
 		seed_value_wrong_type();
 		return 0;
 	}
-	
-	return (guchar)cv;
+
+	return (guchar) cv;
 }
 
-JSValueRef	seed_value_from_uchar(guchar val)
+JSValueRef seed_value_from_uchar(guchar val)
 {
-	return JSValueMakeNumber(eng->context, (gdouble)val);
+	return JSValueMakeNumber(eng->context, (gdouble) val);
 }
 
-glong		seed_value_to_long(JSValueRef val)
+glong seed_value_to_long(JSValueRef val)
 {
-	if(!JSValueIsNumber(eng->context, val))
-	{
-		if(!JSValueIsNull(eng->context, val))
+	if (!JSValueIsNumber(eng->context, val)) {
+		if (!JSValueIsNull(eng->context, val))
 			seed_value_wrong_type();
 		return 0;
 	}
-	
-	return (glong)JSValueToNumber(eng->context, val, NULL);
+
+	return (glong) JSValueToNumber(eng->context, val, NULL);
 }
 
-JSValueRef	seed_value_from_long(glong val)
+JSValueRef seed_value_from_long(glong val)
 {
-	return JSValueMakeNumber(eng->context, (gdouble)val);
+	return JSValueMakeNumber(eng->context, (gdouble) val);
 }
 
-gulong		seed_value_to_ulong(JSValueRef val)
+gulong seed_value_to_ulong(JSValueRef val)
 {
-	if(!JSValueIsNumber(eng->context, val))
-	{
-		if(!JSValueIsNull(eng->context, val))
+	if (!JSValueIsNumber(eng->context, val)) {
+		if (!JSValueIsNull(eng->context, val))
 			seed_value_wrong_type();
 		return 0;
 	}
-	
-	return (gulong)JSValueToNumber(eng->context, val, NULL);
+
+	return (gulong) JSValueToNumber(eng->context, val, NULL);
 }
 
-JSValueRef	seed_value_from_ulong(gulong val)
+JSValueRef seed_value_from_ulong(gulong val)
 {
-	return JSValueMakeNumber(eng->context, (gdouble)val);
+	return JSValueMakeNumber(eng->context, (gdouble) val);
 }
 
-gint64		seed_value_to_int64(JSValueRef val)
+gint64 seed_value_to_int64(JSValueRef val)
 {
-	if(!JSValueIsNumber(eng->context, val))
-	{
-		if(!JSValueIsNull(eng->context, val))
+	if (!JSValueIsNumber(eng->context, val)) {
+		if (!JSValueIsNull(eng->context, val))
 			seed_value_wrong_type();
 		return 0;
 	}
-	
-	return (gint64)JSValueToNumber(eng->context, val, NULL);
+
+	return (gint64) JSValueToNumber(eng->context, val, NULL);
 }
 
-JSValueRef	seed_value_from_int64(gint64 val)
+JSValueRef seed_value_from_int64(gint64 val)
 {
-	return JSValueMakeNumber(eng->context, (gdouble)val);
+	return JSValueMakeNumber(eng->context, (gdouble) val);
 }
 
-guint64		seed_value_to_uint64(JSValueRef val)
+guint64 seed_value_to_uint64(JSValueRef val)
 {
-	if(!JSValueIsNumber(eng->context, val))
-	{
-		if(!JSValueIsNull(eng->context, val))
+	if (!JSValueIsNumber(eng->context, val)) {
+		if (!JSValueIsNull(eng->context, val))
 			seed_value_wrong_type();
 		return 0;
 	}
-	
-	return (guint64)JSValueToNumber(eng->context, val, NULL);
+
+	return (guint64) JSValueToNumber(eng->context, val, NULL);
 }
 
-JSValueRef	seed_value_from_uint64(guint64 val)
+JSValueRef seed_value_from_uint64(guint64 val)
 {
-	return JSValueMakeNumber(eng->context, (gdouble)val);
+	return JSValueMakeNumber(eng->context, (gdouble) val);
 }
 
-gfloat		seed_value_to_float(JSValueRef val)
+gfloat seed_value_to_float(JSValueRef val)
 {
-	if(!JSValueIsNumber(eng->context, val))
-	{
-		if(!JSValueIsNull(eng->context, val))
+	if (!JSValueIsNumber(eng->context, val)) {
+		if (!JSValueIsNull(eng->context, val))
 			seed_value_wrong_type();
 		return 0;
 	}
-	
-	return (gfloat)JSValueToNumber(eng->context, val, NULL);
+
+	return (gfloat) JSValueToNumber(eng->context, val, NULL);
 }
 
-JSValueRef	seed_value_from_float(gfloat val)
+JSValueRef seed_value_from_float(gfloat val)
 {
-	return JSValueMakeNumber(eng->context, (gdouble)val);
+	return JSValueMakeNumber(eng->context, (gdouble) val);
 }
 
-gdouble		seed_value_to_double(JSValueRef val)
+gdouble seed_value_to_double(JSValueRef val)
 {
-	if(!JSValueIsNumber(eng->context, val))
-	{
-		if(!JSValueIsNull(eng->context, val))
+	if (!JSValueIsNumber(eng->context, val)) {
+		if (!JSValueIsNull(eng->context, val))
 			seed_value_wrong_type();
 		return 0;
 	}
-	
-	return (gdouble)JSValueToNumber(eng->context, val, NULL);
+
+	return (gdouble) JSValueToNumber(eng->context, val, NULL);
 }
 
-JSValueRef	seed_value_from_double(gdouble val)
+JSValueRef seed_value_from_double(gdouble val)
 {
-	return JSValueMakeNumber(eng->context, (gdouble)val);
+	return JSValueMakeNumber(eng->context, (gdouble) val);
 }
 
-gchar *		seed_value_to_string(JSValueRef val)
+gchar *seed_value_to_string(JSValueRef val)
 {
 	JSStringRef jsstr;
 	JSValueRef func, str;
-	gchar * buf;
+	gchar *buf;
 	gint length;
-	
-	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))
-	{
+
+	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
+	} else {
+		if (!JSValueIsString(eng->context, val))	// In this case, it's an object
 		{
 			func = seed_value_get_property(val, "toString");
-			str = JSObjectCallAsFunction(eng->context, (JSObjectRef)func, (JSObjectRef)val, 0, NULL, NULL);
+			str =
+			    JSObjectCallAsFunction(eng->context,
+						   (JSObjectRef) func,
+						   (JSObjectRef) val, 0, NULL,
+						   NULL);
 		}
-		
+
 		jsstr = JSValueToStringCopy(eng->context, val, NULL);
 		length = JSStringGetMaximumUTF8CStringSize(jsstr);
-		
+
 		buf = malloc(length * sizeof(gchar));
 		JSStringGetUTF8CString(jsstr, buf, length);
 		JSStringRelease(jsstr);
 	}
-	
+
 	return buf;
 }
 
-JSValueRef	seed_value_from_string(const gchar * val)
+JSValueRef seed_value_from_string(const gchar * val)
 {
 	JSStringRef jsstr = JSStringCreateWithUTF8CString(val);
 	JSValueRef valstr = JSValueMakeString(eng->context, jsstr);
 	JSStringRelease(jsstr);
-	
+
 	return valstr;
 }
 
-GObject *	seed_value_to_object(JSValueRef val)
+GObject *seed_value_to_object(JSValueRef val)
 {
-	GObject * gobject;
-	
-	if(!seed_value_is_gobject(val))
-	{
+	GObject *gobject;
+
+	if (!seed_value_is_gobject(val)) {
 		return NULL;
-	}	
-	
-	if(JSValueIsObjectOfClass(eng->context, val, gobject_class))
-		gobject = (GObject*)JSObjectGetPrivate((JSObjectRef)val);
+	}
+
+	if (JSValueIsObjectOfClass(eng->context, val, gobject_class))
+		gobject = (GObject *) JSObjectGetPrivate((JSObjectRef) val);
 	else
 		gobject = NULL;
 
 	return gobject;
 }
 
-JSValueRef	seed_value_from_object(GObject * val)
+JSValueRef seed_value_from_object(GObject * val)
 {
-	if(val == NULL)
+	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	Tue Nov  4 05:43:44 2008
@@ -17,66 +17,61 @@
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-
 #ifndef _SEED_TYPES_H
 #define _SEED_TYPES_H
 
 #include "seed-private.h"
 
 SeedValue seed_value_from_gvalue(GValue * gval);
-SeedValue seed_value_get_property(SeedValue val,
-				  const char * name);
+SeedValue seed_value_get_property(SeedValue val, const char *name);
 
 gboolean seed_value_set_property(JSObjectRef object,
-				 const char * name, JSValueRef value);
-gboolean seed_gvalue_from_seed_value(SeedValue val,
-				     GType type,
-				     GValue * gval);
+				 const char *name, JSValueRef value);
+gboolean seed_gvalue_from_seed_value(SeedValue val, GType type, GValue * gval);
 gboolean seed_gi_supports_type(GITypeInfo * type_info);
-gboolean seed_gi_make_argument(SeedValue value, GITypeInfo *type_info,
+gboolean seed_gi_make_argument(SeedValue value, GITypeInfo * type_info,
 			       GArgument * arg);
-JSValueRef seed_gi_argument_make_js(GArgument * arg, GITypeInfo *type_info);
+JSValueRef seed_gi_argument_make_js(GArgument * arg, GITypeInfo * type_info);
 
-GType seed_gi_type_to_gtype(GITypeInfo *type_info, GITypeTag tag);
+GType seed_gi_type_to_gtype(GITypeInfo * type_info, GITypeTag tag);
 
-gboolean	seed_value_to_boolean(JSValueRef val);
-JSValueRef	seed_value_from_boolean(gboolean val);
+gboolean seed_value_to_boolean(JSValueRef val);
+JSValueRef seed_value_from_boolean(gboolean val);
 
-guint		seed_value_to_uint(JSValueRef val);
-JSValueRef	seed_value_from_uint(guint val);
+guint seed_value_to_uint(JSValueRef val);
+JSValueRef seed_value_from_uint(guint val);
 
-gint		seed_value_to_int(JSValueRef val);
-JSValueRef	seed_value_from_int(gint val);
+gint seed_value_to_int(JSValueRef val);
+JSValueRef seed_value_from_int(gint val);
 
-gchar		seed_value_to_char(JSValueRef val);
-JSValueRef	seed_value_from_char(gchar val);
+gchar seed_value_to_char(JSValueRef val);
+JSValueRef seed_value_from_char(gchar val);
 
-guchar		seed_value_to_uchar(JSValueRef val);
-JSValueRef	seed_value_from_uchar(guchar val);
+guchar seed_value_to_uchar(JSValueRef val);
+JSValueRef seed_value_from_uchar(guchar val);
 
-glong		seed_value_to_long(JSValueRef val);
-JSValueRef	seed_value_from_long(glong val);
+glong seed_value_to_long(JSValueRef val);
+JSValueRef seed_value_from_long(glong val);
 
-gulong		seed_value_to_ulong(JSValueRef val);
-JSValueRef	seed_value_from_ulong(gulong val);
+gulong seed_value_to_ulong(JSValueRef val);
+JSValueRef seed_value_from_ulong(gulong val);
 
-gint64		seed_value_to_int64(JSValueRef val);
-JSValueRef	seed_value_from_int64(gint64 val);
+gint64 seed_value_to_int64(JSValueRef val);
+JSValueRef seed_value_from_int64(gint64 val);
 
-guint64		seed_value_to_uint64(JSValueRef val);
-JSValueRef	seed_value_from_uint64(guint64 val);
+guint64 seed_value_to_uint64(JSValueRef val);
+JSValueRef seed_value_from_uint64(guint64 val);
 
-gfloat		seed_value_to_float(JSValueRef val);
-JSValueRef	seed_value_from_float(gfloat val);
+gfloat seed_value_to_float(JSValueRef val);
+JSValueRef seed_value_from_float(gfloat val);
 
-gdouble		seed_value_to_double(JSValueRef val);
-JSValueRef	seed_value_from_double(gdouble val);
+gdouble seed_value_to_double(JSValueRef val);
+JSValueRef seed_value_from_double(gdouble val);
 
-gchar *		seed_value_to_string(JSValueRef val);
-JSValueRef	seed_value_from_string(const gchar * val);
+gchar *seed_value_to_string(JSValueRef val);
+JSValueRef seed_value_from_string(const gchar * val);
 
-GObject *	seed_value_to_object(JSValueRef val);
-JSValueRef	seed_value_from_object(GObject * val);
+GObject *seed_value_to_object(JSValueRef val);
+JSValueRef seed_value_from_object(GObject * val);
 
 #endif
-

Modified: trunk/libseed/seed.h
==============================================================================
--- trunk/libseed/seed.h	(original)
+++ trunk/libseed/seed.h	Tue Nov  4 05:43:44 2008
@@ -17,7 +17,6 @@
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-
 #ifndef _SEED_H
 #define _SEED_H
 
@@ -30,60 +29,60 @@
 typedef struct _SeedScript SeedScript;
 
 /* seed-engine.c */
-gboolean seed_init(int * argc, char *** argv);
+gboolean seed_init(int *argc, char ***argv);
 
-SeedScript * seed_make_script(const gchar *s, const gchar * source_url,
-			      int line_number);
-SeedException seed_script_exception(SeedScript *s);
+SeedScript *seed_make_script(const gchar * s, const gchar * source_url,
+			     int line_number);
+SeedException seed_script_exception(SeedScript * s);
 SeedException seed_make_exception(gchar * name, gchar * message);
-gchar * seed_exception_get_name(SeedException e);
-gchar * seed_exception_get_message(SeedException e);
+gchar *seed_exception_get_name(SeedException e);
+gchar *seed_exception_get_message(SeedException e);
 guint seed_exception_get_line(SeedException e);
-gchar * seed_exception_get_file(SeedException e);
+gchar *seed_exception_get_file(SeedException e);
 
-SeedValue seed_evaluate(SeedScript *s, SeedObject this);
+SeedValue seed_evaluate(SeedScript * s, SeedObject this);
 
-gchar * seed_value_to_string(SeedValue obj);
+gchar *seed_value_to_string(SeedValue obj);
 
 /* seed-types.c */
 
-gboolean	seed_value_to_boolean(SeedValue val);
-SeedValue	seed_value_from_boolean(gboolean val);
+gboolean seed_value_to_boolean(SeedValue val);
+SeedValue seed_value_from_boolean(gboolean val);
 
-guint		seed_value_to_uint(SeedValue val);
-SeedValue	seed_value_from_uint(guint val);
+guint seed_value_to_uint(SeedValue val);
+SeedValue seed_value_from_uint(guint val);
 
-gint		seed_value_to_int(SeedValue val);
-SeedValue	seed_value_from_int(gint val);
+gint seed_value_to_int(SeedValue val);
+SeedValue seed_value_from_int(gint val);
 
-gchar		seed_value_to_char(SeedValue val);
-SeedValue	seed_value_from_char(gchar val);
+gchar seed_value_to_char(SeedValue val);
+SeedValue seed_value_from_char(gchar val);
 
-guchar		seed_value_to_uchar(SeedValue val);
-SeedValue	seed_value_from_uchar(guchar val);
+guchar seed_value_to_uchar(SeedValue val);
+SeedValue seed_value_from_uchar(guchar val);
 
-glong		seed_value_to_long(SeedValue val);
-SeedValue	seed_value_from_long(glong val);
+glong seed_value_to_long(SeedValue val);
+SeedValue seed_value_from_long(glong val);
 
-gulong		seed_value_to_ulong(SeedValue val);
-SeedValue	seed_value_from_ulong(gulong val);
+gulong seed_value_to_ulong(SeedValue val);
+SeedValue seed_value_from_ulong(gulong val);
 
-gint64		seed_value_to_int64(SeedValue val);
-SeedValue	seed_value_from_int64(gint64 val);
+gint64 seed_value_to_int64(SeedValue val);
+SeedValue seed_value_from_int64(gint64 val);
 
-guint64		seed_value_to_uint64(SeedValue val);
-SeedValue	seed_value_from_uint64(guint64 val);
+guint64 seed_value_to_uint64(SeedValue val);
+SeedValue seed_value_from_uint64(guint64 val);
 
-gfloat		seed_value_to_float(SeedValue val);
-SeedValue	seed_value_from_float(gfloat val);
+gfloat seed_value_to_float(SeedValue val);
+SeedValue seed_value_from_float(gfloat val);
 
-gdouble		seed_value_to_double(SeedValue val);
-SeedValue	seed_value_from_double(gdouble val);
+gdouble seed_value_to_double(SeedValue val);
+SeedValue seed_value_from_double(gdouble val);
 
-gchar *		seed_value_to_string(SeedValue val);
-SeedValue	seed_value_from_string(gchar * val);
+gchar *seed_value_to_string(SeedValue val);
+SeedValue seed_value_from_string(gchar * val);
 
-GObject *	seed_value_to_object(SeedValue val);
-SeedValue	seed_value_from_object(GObject * val);
+GObject *seed_value_to_object(SeedValue val);
+SeedValue seed_value_from_object(GObject * val);
 
 #endif



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