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 632626 - support signals with G_TYPE_POINTER argument
support signals with G_TYPE_POINTER argument
Status: RESOLVED FIXED
Product: gjs
Classification: Bindings
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gjs-maint
gjs-maint
Depends on:
Blocks: 632109
 
 
Reported: 2010-10-20 03:47 UTC by Maxim Ermilov
Modified: 2010-11-18 23:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
support signals with G_TYPE_POINTER argument (4.08 KB, patch)
2010-10-20 03:47 UTC, Maxim Ermilov
reviewed Details | Review
support signals with G_TYPE_POINTER argument (3.97 KB, patch)
2010-10-27 14:12 UTC, Maxim Ermilov
committed Details | Review

Description Maxim Ermilov 2010-10-20 03:47:36 UTC
Created attachment 172788 [details] [review]
support signals with  G_TYPE_POINTER argument

get information about type of argument from gobject-introspection
Comment 1 Colin Walters 2010-10-26 15:55:46 UTC
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)
Comment 2 Colin Walters 2010-10-26 15:56:28 UTC
Also, what function were you trying to call?  I think it's helpful to mention in the commit message the real-world API.
Comment 3 Maxim Ermilov 2010-10-27 14:12:43 UTC
Created attachment 173326 [details] [review]
support signals with G_TYPE_POINTER argument

Example of such signal:
evolution-data-server.libecal
ECalView::objects-added
Comment 4 Colin Walters 2010-11-17 14:59:24 UTC
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.
Comment 5 Colin Walters 2010-11-18 23:32:18 UTC
Attachment 173326 [details] pushed as 6fed532 - support signals with G_TYPE_POINTER argument