GNOME Bugzilla – Bug 632626
support signals with G_TYPE_POINTER argument
Last modified: 2010-11-18 23:32:22 UTC
Created attachment 172788 [details] [review] support signals with G_TYPE_POINTER argument get information about type of argument from gobject-introspection
Review of attachment 172788 [details] [review]: ::: gi/value.c @@ +646,3 @@ + GIBaseInfo *obj = g_irepository_find_by_gtype(NULL, signal_query->itype); + if (!obj) { + gjs_throw(context, "Object does not have introspection."); I think: gjs_throw(context, "Signal argument with GType %s isn't introspectable", g_type_name(signal_query->itype)); is better. @@ +647,3 @@ + if (!obj) { + gjs_throw(context, "Object does not have introspection."); + return JS_FALSE; Missing a g_base_info_unref (obj) in this path; can you rebase this patch on top of that? @@ +660,3 @@ + g_base_info_unref(signal_info); + continue; + } I just added a function for this, see: https://bugzilla.gnome.org/show_bug.cgi?id=633204 Can you rebase your patch on top of that? @@ +662,3 @@ + } + arg_info = g_callable_info_get_arg(signal_info, arg_n - 1); + type_info = g_arg_info_get_type(arg_info); You should use g_arg_info_load_type () instead to avoid an extra allocation. (I'm slowly adding more _load_* type APIs)
Also, what function were you trying to call? I think it's helpful to mention in the commit message the real-world API.
Created attachment 173326 [details] [review] support signals with G_TYPE_POINTER argument Example of such signal: evolution-data-server.libecal ECalView::objects-added
Review of attachment 173326 [details] [review]: Looks good now, thanks! In the big picture, we should probably consider *always* using the introspection information, but I'm not sure of the potential ramifications yet.
Attachment 173326 [details] pushed as 6fed532 - support signals with G_TYPE_POINTER argument