! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
[PATCH] Fix/workaround vala binding for XfceRc
Status:
RESOLVED: FIXED
Product:
Libxfce4util
Component:
General

Comments

Description Natanael Copa 2018-10-17 10:42:38 CEST
Created attachment 8038 
fix vala binding

The gobject-instrospection fails to generate XfceRc as a class, and fails to define the xfce_rc_simple_open() and xfce_rc_config_open() at all.

For vala binding we can work around that by add a -custom.vala.
Comment 1 Skunnyk editbugs 2018-10-19 22:38:11 CEST
Hi,

Thank you for your patch. After applying the fix, I have the following warning :

# /usr/bin/vapigen-0.42  --library libxfce4util-1.0 --metadatadir .  --girdir /usr/local/share/gir-1.0  libxfce4util-1.0.gir libxfce4util-1.0-custom.vala  
(vapigen-0.42:6880): GLib-GObject-WARNING **: 22:27:11.725: invalid cast from 'ValaClass' to 'ValaStruct'
Generation succeeded - 0 warning(s)
Comment 2 Natanael Copa 2018-10-30 11:47:03 CET
Yes, and I don't know how to remove the warning. The vala code seems to work though.
Comment 3 Natanael Copa 2018-12-04 10:07:25 CET
I think this is related:

  GISCAN   libxfce4util-1.0.gir
...
xfce-rc.c:109: Warning: libxfce4util: xfce_rc_simple_open: return value: Invalid non-constant return of bare structure or union; register as boxed type or (skip)
xfce-rc.c:153: Warning: libxfce4util: xfce_rc_config_open: return value: Invalid non-constant return of bare structure or union; register as boxed type or (skip)
xfce-rc.c:153: Warning: libxfce4util: xfce_rc_config_open: return value: Invalid non-constant return of bare structure or union; register as boxed type or (skip)
xfce-rc.c:109: Warning: libxfce4util: xfce_rc_simple_open: return value: Invalid non-constant return of bare structure or union; register as boxed type or (skip)


The gi-r-scanner is not able to register xfce_rc_* as an object. I think the proper solution is to refactor the XfceRc struct to a proper gobject class.

See https://wiki.gnome.org/Projects/GObjectIntrospection/WritingBindingableAPIs
Comment 4 Skunnyk editbugs 2018-12-19 22:54:20 CET
Note: we also need to update libxfce4util/Makefile.am to change the c-include to the correct one :
-       --c-include=libxfce4util.h
+       --c-include=libxfce4util/libxfce4util.h
Comment 5 Olivier Duchateau 2019-01-20 21:45:47 CET
Created attachment 8255 
Fix GObject Introspection language bindings

This patch fixes Xfce.Rc class (used in Vala) for 'xfce_rc_simple_open' and 'xfce_rc_config_open' methods.
Comment 6 Natanael Copa 2019-01-21 17:09:34 CET
(In reply to Olivier Duchateau from comment #5)
> Created attachment 8255 
> Fix GObject Introspection language bindings
> 
> This patch fixes Xfce.Rc class (used in Vala) for 'xfce_rc_simple_open' and
> 'xfce_rc_config_open' methods.

Awesome! This fixes the problem for me. Thanks!
Comment 7 Skunnyk editbugs 2019-01-21 18:21:50 CET
Awesome² !
xfce_rc_get_type need to be added in libxfce4util/libxfce4util.symbols to fix make distcheck  (tests run by libxfce4util/abicheck.sh)
Comment 8 Olivier Duchateau 2019-01-22 06:24:59 CET
Created attachment 8258 
Fix GObject Introspection language bindings

Add xfce_rc_get_type in libxfce4util.symbols (Skunnyk's suggestion); Otherwise nothing changed.
Comment 9 Skunnyk editbugs 2019-03-13 22:50:37 CET
Thank you very much !
Forgot to add the issue number in the commit message.
Pushed to master on https://git.xfce.org/xfce/libxfce4util/commit/?id=99f20b70df5a02043e14b82d693deda14804c17c

Bug #14766

Reported by:
Natanael Copa
Reported on: 2018-10-17
Last modified on: 2019-03-20

People

Assignee:
Skunnyk
CC List:
2 users

Version

Version:
4.13.2

Attachments

fix vala binding (1.62 KB, patch)
2018-10-17 10:42 CEST , Natanael Copa
no flags
Fix GObject Introspection language bindings (2.70 KB, patch)
2019-01-20 21:45 CET , Olivier Duchateau
no flags
Fix GObject Introspection language bindings (3.20 KB, patch)
2019-01-22 06:24 CET , Olivier Duchateau
no flags

Additional information