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 688040 - emit functions for (allow-none) self arguments
emit functions for (allow-none) self arguments
Status: RESOLVED OBSOLETE
Product: gobject-introspection
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks: 687898
 
 
Reported: 2012-11-10 14:33 UTC by Daiki Ueno
Modified: 2018-02-08 12:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
giscanner: don't treat functions with nullable first argument as method (9.16 KB, patch)
2013-06-20 07:53 UTC, Daiki Ueno
none Details | Review

Description Daiki Ueno 2012-11-10 14:33:21 UTC
I'd like to use gdk_window_add_filter through pygobject, which seems currently inaccessible but was available through pygtk:

http://pygtk.org/docs/pygtk/class-gdkwindow.html#method-gdkwindow--add-filter

The function currently has "(skip)" annotation and I requested to remove it:

https://bugzilla.gnome.org/show_bug.cgi?id=687898

However, even it is removed, a couple of obstacles remain:

1. there seems no easy way to pass NULL as the first (self) argument

   I tried:

   >>> Gdk.Window.add_filter(None, filter, None) #-> error

   >>> Gdk.Window.add_filter.__info__.invoke(None, filter, None) #-> error

   >>> rootwin = Gdk.get_default_root_window()
   >>> bound = rootwin.add_filter.__get__(None, None.__class__) #-> still unbound

2. the callback cannot receive GdkXEvent argument (which is converted to NULL)
Comment 1 Martin Pitt 2012-11-19 07:04:48 UTC
As discussed in bug 687898, I'm reassinging this to gobject-introspection. If we have a method whose self argument is (allow-none), the GI scanner should emit this as a function instead (or in addition, for backwards compatibility).
Comment 2 Daiki Ueno 2013-06-20 07:53:36 UTC
Created attachment 247300 [details] [review]
giscanner: don't treat functions with nullable first argument as method

There are a few functions whose first argument is marked as
(allow-none) (e.g. gdk_window_add_filter).  g-ir-scanner currently
recognize them as a method instead of function.  If a user really
wants to pass NULL, language bindings need to call them as a method of
NULL instance.  This is not so useful and even not possible with some
language bindings.  This patch makes g-ir-scanner emit "function"
instead of "method" in that case.
Comment 3 Simon Feltman 2013-12-09 00:40:30 UTC
This has some overlap with bug 688242. Now that there are annotations in gir files for the instance arguments, this could be moved in the direction of getting the following to work:

Gdk.Window.add_filter(None, filter, None)

We need to build the instance arg info into typelibs and GI API, then fix up language bindings to also use this info.
Comment 4 André Klapper 2015-02-07 17:17:10 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]
Comment 5 GNOME Infrastructure Team 2018-02-08 12:19:37 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gobject-introspection/issues/76.