seed r148 - in trunk: libseed tests
- From: racarr svn gnome org
- To: svn-commits-list gnome org
- Subject: seed r148 - in trunk: libseed tests
- Date: Thu, 6 Nov 2008 16:43:56 +0000 (UTC)
Author: racarr
Date: Thu Nov 6 16:43:56 2008
New Revision: 148
URL: http://svn.gnome.org/viewvc/seed?rev=148&view=rev
Log:
Make seed_gobject_get_class_for_gtype propertly construct class for
types without introspection data.
Modified:
trunk/libseed/seed-builtins.c
trunk/libseed/seed-engine.c
trunk/tests/subclass.js
Modified: trunk/libseed/seed-builtins.c
==============================================================================
--- trunk/libseed/seed-builtins.c (original)
+++ trunk/libseed/seed-builtins.c Thu Nov 6 16:43:56 2008
@@ -421,6 +421,25 @@
};
gchar * new_type_name;
+ if (argumentCount != 3)
+ {
+ gchar * mes = g_strdup_printf("Seed.define_gtype expected 3"
+ " arguments, got %d",
+ argumentCount);
+ seed_make_exception(exception, "ArgumentError", mes);
+ g_free(mes);
+ return JSValueMakeNull(eng->context);
+ }
+
+ if (!JSValueIsObjectOfClass(eng->context,
+ arguments[0],
+ gobject_constructor_class))
+ {
+ seed_make_exception(exception, "ArgumentError",
+ "Seed.define_gtype expected"
+ " GObject type as first argument");
+ return JSValueMakeNull(eng->context);
+ }
parent_type = (GType)JSObjectGetPrivate((JSObjectRef)arguments[0]);
parent_interfaces = g_type_interfaces(parent_type, &n_parent_interfaces);
Modified: trunk/libseed/seed-engine.c
==============================================================================
--- trunk/libseed/seed-engine.c (original)
+++ trunk/libseed/seed-engine.c Thu Nov 6 16:43:56 2008
@@ -361,8 +361,6 @@
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;
memset(&def, 0, sizeof(JSClassDefinition));
@@ -379,9 +377,6 @@
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);
@@ -391,6 +386,13 @@
g_type_set_qdata(type, qname, ref);
g_type_set_qdata(type, qprototype, prototype_obj);
+ if (!info || !(g_base_info_get_type(info) == GI_INFO_TYPE_OBJECT))
+ return 0;
+
+ seed_gobject_add_methods_for_type((GIObjectInfo *) info, prototype_obj);
+ seed_gobject_add_methods_for_interfaces((GIObjectInfo *) info,
+ prototype_obj);
+
return ref;
}
Modified: trunk/tests/subclass.js
==============================================================================
--- trunk/tests/subclass.js (original)
+++ trunk/tests/subclass.js Thu Nov 6 16:43:56 2008
@@ -41,7 +41,8 @@
{
if (widget.fooed == true)
{
- widget.set_text("Fooed");
+ widget.set_text("Fooed");
+ Seed.print("Found a fooed widget");
}
else
{
@@ -50,4 +51,3 @@
});
w.show_all();
-Gtk.main()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]