-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove (closure) annotations #182
base: main
Are you sure you want to change the base?
Conversation
cc: @ebassi, the warning is a bit confusing, it makes me thing that the closure annotation should indeed go in the callback's parameter ( |
It doesn't say "the callback's parameter", though. The warning says: "the callback parameter", i.e. the parameter that is a callback. We cannot put a whole treatise into a warning: people already don't read them as is. |
It actually picks up anything that ends with |
The `(closure)` annotation should go in the callback parameter, e.g. `* @callback: (scope async) (closure data): a callback ...` however gobject-introspection will automatically pick up gpointer parameters ending in `data` as the parameter of the callback. Fixes the warnings: ``` [36/45] Generating libportal/Xdp-1.0.gir with a custom command (wrapped by meson to set env) ../libportal/account.c:209: Warning: Xdp: invalid "closure" annotation: only valid on callback parameters ../libportal/background.c:329: Warning: Xdp: invalid "closure" annotation: only valid on callback parameters ../libportal/background.c:399: Warning: Xdp: invalid "closure" annotation: only valid on callback parameters ../libportal/camera.c:218: Warning: Xdp: invalid "closure" annotation: only valid on callback parameters ../libportal/dynamic-launcher.c:236: Warning: Xdp: invalid "closure" annotation: only valid on callback parameters ../libportal/email.c:308: Warning: Xdp: invalid "closure" annotation: only valid on callback parameters ../libportal/filechooser.c:245: Warning: Xdp: invalid "closure" annotation: only valid on callback parameters ../libportal/filechooser.c:353: Warning: Xdp: invalid "closure" annotation: only valid on callback parameters ../libportal/filechooser.c:446: Warning: Xdp: invalid "closure" annotation: only valid on callback parameters ../libportal/inhibit.c:218: Warning: Xdp: invalid "closure" annotation: only valid on callback parameters ../libportal/inhibit.c:569: Warning: Xdp: invalid "closure" annotation: only valid on callback parameters ../libportal/inputcapture.c:727: Warning: Xdp: invalid "closure" annotation: only valid on callback parameters ../libportal/location.c:330: Warning: Xdp: invalid "closure" annotation: only valid on callback parameters ../libportal/notification.c:723: Warning: Xdp: invalid "closure" annotation: only valid on callback parameters ../libportal/openuri.c:277: Warning: Xdp: invalid "closure" annotation: only valid on callback parameters ../libportal/openuri.c:344: Warning: Xdp: invalid "closure" annotation: only valid on callback parameters ../libportal/print.c:280: Warning: Xdp: invalid "closure" annotation: only valid on callback parameters ../libportal/print.c:358: Warning: Xdp: invalid "closure" annotation: only valid on callback parameters ../libportal/remote.c:460: Warning: Xdp: invalid "closure" annotation: only valid on callback parameters ../libportal/remote.c:530: Warning: Xdp: invalid "closure" annotation: only valid on callback parameters ../libportal/remote.c:570: Warning: Xdp: invalid "closure" annotation: only valid on callback parameters ../libportal/remote.c:808: Warning: Xdp: invalid "closure" annotation: only valid on callback parameters ../libportal/screenshot.c:224: Warning: Xdp: invalid "closure" annotation: only valid on callback parameters ../libportal/screenshot.c:288: Warning: Xdp: invalid "closure" annotation: only valid on callback parameters ../libportal/spawn.c:203: Warning: Xdp: invalid "closure" annotation: only valid on callback parameters ../libportal/trash.c:128: Warning: Xdp: invalid "closure" annotation: only valid on callback parameters ../libportal/updates.c:208: Warning: Xdp: invalid "closure" annotation: only valid on callback parameters ../libportal/updates.c:391: Warning: Xdp: invalid "closure" annotation: only valid on callback parameters ../libportal/wallpaper.c:286: Warning: Xdp: invalid "closure" annotation: only valid on callback parameters ```
1519b25
to
c749f8c
Compare
I updated the commit description, would it be better if I renamed them to user_data instead? |
It's fine either way; |
The
(closure)
annotation should go in the callback parameter, e.g.* @callback: (scope async) (closure data): a callback ...
however gobject-introspection will automatically pick up a parameter called
data
as the parameter of the callback.Fixes the warnings: