After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 695857 - seed does not support signals with annotated types
seed does not support signals with annotated types
Status: RESOLVED FIXED
Product: seed
Classification: Bindings
Component: libseed
git master
Other Linux
: Normal normal
: ---
Assigned To: Alban Crequy
seed-maint
Depends on:
Blocks:
 
 
Reported: 2013-03-14 15:09 UTC by Alban Crequy
Modified: 2013-04-14 12:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[PATCH] support signals with annotated types (7.43 KB, patch)
2013-03-15 13:56 UTC, Alban Crequy
none Details | Review

Description Alban Crequy 2013-03-14 15:09:36 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?
Comment 1 Alan Knowles 2013-03-14 23:14:56 UTC
That's been on the todo list for a while - just nobody has had time to implement it.
Comment 2 Alban Crequy 2013-03-15 10:33:13 UTC
I am preparing a patch for it.
Comment 3 Alban Crequy 2013-03-15 13:56:56 UTC
Created attachment 238979 [details] [review]
[PATCH] support signals with annotated types
Comment 4 Tomeu Vizoso 2013-03-18 09:22:53 UTC
(In reply to comment #3)
> Created an attachment (id=238979) [details] [review]
> [PATCH] support signals with annotated types

Patch looks good to me, FWIW.
Comment 5 Alan Knowles 2013-04-14 12:48:24 UTC
this has been applied already..
Comment 6 Alan Knowles 2013-04-14 12:53:44 UTC
oops wrong status