GNOME Bugzilla – Bug 695857
seed does not support signals with annotated types
Last modified: 2013-04-14 12:53:44 UTC
When a C library declares a GLib signal like this: /** * MyObject::my-signal: * @self: * @items: (type GLib.List) (element-type MyLibrary.Item): */ signals[MY_SIGNAL] = g_signal_new ("my-signal", MY_TYPE_OBJECT, G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (MyObjectClass, my_signal), NULL, NULL, my_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); and a signal gets emitted from the C library, signal handlers in javascript will only get a "seed_pointer" because Seed sees "G_TYPE_POINTER" for the first parameter. Seed ignores the annotation saying it is a GList of Item. seed/libseed/seed-types.c:1299:seed_value_from_gvalue: case G_TYPE_POINTER: return seed_make_pointer (ctx, g_value_get_pointer (gval)); It seems gjs has the code to make signal work with annotated types: gjs/gi/value.c:768:gjs_value_from_g_value_internal. Could we do the same in seed?
That's been on the todo list for a while - just nobody has had time to implement it.
I am preparing a patch for it.
Created attachment 238979 [details] [review] [PATCH] support signals with annotated types
(In reply to comment #3) > Created an attachment (id=238979) [details] [review] > [PATCH] support signals with annotated types Patch looks good to me, FWIW.
this has been applied already..
oops wrong status