seed r79 - in trunk: autom4te.cache libseed tests
- From: racarr svn gnome org
- To: svn-commits-list gnome org
- Subject: seed r79 - in trunk: autom4te.cache libseed tests
- Date: Mon, 3 Nov 2008 09:31:55 +0000 (UTC)
Author: racarr
Date: Mon Nov 3 09:31:55 2008
New Revision: 79
URL: http://svn.gnome.org/viewvc/seed?rev=79&view=rev
Log:
List type conversion.
Added:
trunk/tests/list-test.js (contents, props changed)
Removed:
trunk/autom4te.cache/
Modified:
trunk/libseed/seed-types.c
Modified: trunk/libseed/seed-types.c
==============================================================================
--- trunk/libseed/seed-types.c (original)
+++ trunk/libseed/seed-types.c Mon Nov 3 09:31:55 2008
@@ -350,6 +350,60 @@
return seed_make_struct(arg->v_pointer, interface);
}
}
+ 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;
+
+ 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:
+ {
+
+ 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;
Added: trunk/tests/list-test.js
==============================================================================
--- (empty file)
+++ trunk/tests/list-test.js Mon Nov 3 09:31:55 2008
@@ -0,0 +1,19 @@
+#!/usr/local/bin/seed
+// Returns: 0
+// STDIN:
+// STDOUT:\[object Object\]\n\[object GtkButton\]\n\[object GtkButton\]
+// STDERR:
+Seed.import_namespace("Gtk");
+
+Gtk.init(null, null);
+
+b1 = new Gtk.Button();
+b2 = new Gtk.Button();
+vbox = new Gtk.VBox();
+vbox.pack_start(b1);
+vbox.pack_start(b2);
+
+children = vbox.get_children();
+Seed.print(children);
+Seed.print(children[0]);
+Seed.print(children[1]);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]