Index: test/js/testEverythingBasic.js
===================================================================
--- test/js/testEverythingBasic.js	(revision 99)
+++ test/js/testEverythingBasic.js	(working copy)
@@ -100,4 +100,11 @@
     assertEquals('/etc/fstab', filenames[1]);
 }
 
+function testGType() {
+    TYPE_STRING = 64;
+    TYPE_GINT = 64;
+    assertEquals(1, Everything.test_gtype_in(1, [TYPE_STRING]));
+    assertEquals(2, Everything.test_gtype_in(2, [TYPE_STRING, TYPE_GINT]));
+}
+
 gjstestRun();
Index: gi/arg.c
===================================================================
--- gi/arg.c	(revision 99)
+++ gi/arg.c	(working copy)
@@ -170,64 +170,47 @@
                   unsigned int length,
                   void       **arr_p)
 {
-    char **result;
+}
+
+static JSBool
+gjs_array_to_array(JSContext   *context,
+                   jsval        array_value,
+                   unsigned int length,
+                   GITypeInfo  *param_info,
+                   void       **arr_p)
+{
     guint32 i;
+    jsval elem;
+    GITypeTag element_type;
+    GArgument *arguments;
 
-    result = g_new0(char *, length+1);
+    arguments = g_new0(GArgument, length+1);
 
     for (i = 0; i < length; ++i) {
         jsval elem;
-
+        
         elem = JSVAL_VOID;
         if (!JS_GetElement(context, JSVAL_TO_OBJECT(array_value),
                            i, &elem)) {
-            g_free(result);
-            gjs_throw(context,
-                      "Missing array element %u",
-                      i);
+            g_free(arguments);
+            gjs_throw(context, "Missing array element %u", i);
             return JS_FALSE;
         }
 
-        if (!JSVAL_IS_STRING(elem)) {
-            gjs_throw(context,
-                      "Invalid element in string array");
-            g_strfreev(result);
+        if (!gjs_value_to_g_arg_with_type_info(context, elem, param_info,
+                                               "element argument", FALSE,
+                                               TRUE, &arguments[i])) {
+            g_free(arguments);
             return JS_FALSE;
         }
-        if (!gjs_string_to_utf8(context, elem, (char **)&(result[i]))) {
-            g_strfreev(result);
-            return JS_FALSE;
-        }
     }
 
-    *arr_p = result;
+    *arr_p = arguments;
 
     return JS_TRUE;
 }
 
 static JSBool
-gjs_array_to_array(JSContext   *context,
-                   jsval        array_value,
-                   unsigned int length,
-                   GITypeInfo  *param_info,
-                   void       **arr_p)
-{
-    guint32 i;
-    jsval elem;
-    GITypeTag element_type;
-
-    element_type = g_type_info_get_tag(param_info);
-
-    if (element_type == GI_TYPE_TAG_UTF8) {
-        return gjs_array_to_strv (context, array_value, length, arr_p);
-    } else {
-        gjs_throw(context,
-                  "Unhandled array element type %d", element_type);
-        return JS_FALSE;
-    }
-}
-
-static JSBool
 gjs_value_to_g_arg_with_type_info(JSContext  *context,
                                   jsval       value,
                                   GITypeInfo *type_info,
@@ -277,6 +260,7 @@
         arg->v_uint8 = (guint8)i;
         break;
     }
+    case GI_TYPE_TAG_GTYPE:
     case GI_TYPE_TAG_INT16: {
         gint32 i;
         if (!JS_ValueToInt32(context, value, &i))
@@ -1042,14 +1026,27 @@
             /* OK */
         } else {
             GITypeInfo *param_info;
-
+            GITypeTag param_type_tag;
+            int i;
+            GArgument *arguments = (GArgument*)arg->v_pointer;
+            
             param_info = g_type_info_get_param_type(type_info, 0);
+            param_type_tag = g_type_info_get_tag( (GITypeInfo*) param_info);
 
-            if (g_type_info_get_tag (param_info) == GI_TYPE_TAG_UTF8 ||
-                g_type_info_get_tag (param_info) == GI_TYPE_TAG_FILENAME)
-                g_strfreev (arg->v_pointer);
-            else
-                g_assert_not_reached ();
+            for (i = 0; i < g_type_info_get_array_length (type_info); i++)
+                {
+                    if (!gjs_g_arg_release_internal(context,
+                                                    transfer,
+                                                    param_info,
+                                                    param_type_tag,
+                                                    &arguments[i])) {
+                            /* no way to recover here, and errors should
+                             * not be possible.
+                             */
+                            g_error("Failed to release list element");
+                            break;
+                        }
+                }
 
             g_base_info_unref((GIBaseInfo*) param_info);
         }
