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 775812 - gobject-introspection-1.0 bindings are terribly broken
gobject-introspection-1.0 bindings are terribly broken
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Bindings: GLib
0.32.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on: 732460
Blocks:
 
 
Reported: 2016-12-08 13:54 UTC by Guillaume Poirier-Morency
Modified: 2017-01-06 07:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Updated bindings (15.20 KB, text/x-vala)
2016-12-08 13:54 UTC, Guillaume Poirier-Morency
  Details
gobject-introspection-1.0: Prettify and fix the whole thing (26.44 KB, patch)
2016-12-10 20:46 UTC, Rico Tzschichholz
none Details | Review
Fix usage as a GObject property (9.08 KB, patch)
2016-12-11 16:58 UTC, Guillaume Poirier-Morency
none Details | Review
Add missing inheritence for type derived from 'GI.CallableInfo' (1.92 KB, patch)
2016-12-11 18:37 UTC, Guillaume Poirier-Morency
none Details | Review
gobject-introspection-1.0: Prettify and fix the whole thing (27.28 KB, patch)
2017-01-04 15:15 UTC, Rico Tzschichholz
none Details | Review
Add 'type_id' to all classes derived from 'GI.BaseInfo' (7.66 KB, patch)
2017-01-05 18:00 UTC, Guillaume Poirier-Morency
none Details | Review
gobject-introspection-1.0: Prettify and fix the whole thing (29.19 KB, patch)
2017-01-05 20:56 UTC, Rico Tzschichholz
committed Details | Review

Description Guillaume Poirier-Morency 2016-12-08 13:54:37 UTC
Created attachment 341615 [details]
Updated bindings

There's a lot of issues with the current binding:

 - BaseInfo has support for reference counting
 - everything is static while it shouldn't

I attached an updated one (by hand) and we shall attempt to get these changes upstream as well.
Comment 1 Guillaume Poirier-Morency 2016-12-08 15:30:52 UTC
Once https://bugzilla.gnome.org/show_bug.cgi?id=732460 is fixed, I can add the metadata to declare the nullable and ref/unref.

I'll be using it quite extensively and will probably improve it considerably here: https://github.com/rainwoodman/vast/pull/38
Comment 2 Rico Tzschichholz 2016-12-10 20:46:13 UTC
Created attachment 341724 [details] [review]
gobject-introspection-1.0: Prettify and fix the whole thing
Comment 3 Guillaume Poirier-Morency 2016-12-11 16:58:44 UTC
Created attachment 341766 [details] [review]
Fix usage as a GObject property

Ok, I give up on exposing getter as properties: it's better to use as much of generated bindings as possible.

This attachement add '[Compact]' annotations as well as 'type_id' for all subclasses of 'GI.BaseInfo'. The latter is necessary to use it as a GObject property.

I might bring more fix later because we would like to expose this via PyGObject with the ability to pass an introspected 'GI.FunctionInfo' to our APIs.
Comment 4 Guillaume Poirier-Morency 2016-12-11 18:37:43 UTC
Created attachment 341768 [details] [review]
Add missing inheritence for type derived from 'GI.CallableInfo'
Comment 5 Rico Tzschichholz 2017-01-04 15:15:56 UTC
Created attachment 342851 [details] [review]
gobject-introspection-1.0: Prettify and fix the whole thing
Comment 6 Rico Tzschichholz 2017-01-04 15:20:46 UTC
This should be as far as it goes now. Marking the common base-type as Compact is sufficient. Marking an GObject as compact is a no-go.
Comment 7 Guillaume Poirier-Morency 2017-01-05 17:39:53 UTC
(In reply to Rico Tzschichholz from comment #6)
> This should be as far as it goes now. Marking the common base-type as
> Compact is sufficient. Marking an GObject as compact is a no-go.

You've misinterpreted me. I meant using the BaseInfo and it's derivated types as property in a GObject, not having it inherit from GObject.

I'll test again against Vast and see if it works.
Comment 8 Guillaume Poirier-Morency 2017-01-05 17:50:01 UTC
It appears that the derived class from BaseInfo does not inherit the 'type_id' attribute. This pose a problem if you want to do something like:

    class Foo : Object {
        FunctionInfo function_info { get; construct }
    }

You get the error:

error: too few arguments to function « g_param_spec_boxed »
 public class Vast.Function : Object
                                                                                        ^                 
In file included from /usr/include/glib-2.0/glib-object.h:28:0,
                 from src/vast-1.0@sha/function.c:6:
/usr/include/glib-2.0/gobject/gparamspecs.h:1097:13: note : declared here
 GParamSpec* g_param_spec_boxed  (const gchar  *name,

It works if we set 'type_id' explicitly for each derived classes.
Comment 9 Guillaume Poirier-Morency 2017-01-05 18:00:47 UTC
Created attachment 342977 [details] [review]
Add 'type_id' to all classes derived from 'GI.BaseInfo'
Comment 10 Rico Tzschichholz 2017-01-05 19:14:58 UTC
(In reply to Guillaume Poirier-Morency from comment #7)
> (In reply to Rico Tzschichholz from comment #6)
> > Marking an GObject as compact is a no-go.
> 
> You've misinterpreted me. I meant using the BaseInfo and it's derivated
> types as property in a GObject, not having it inherit from GObject.

I was referring to this proposed change:
https://bugzilla.gnome.org/attachment.cgi?id=341766&action=diff#a/vapi/gobject-introspection-1.0.vapi_sec12

(In reply to Guillaume Poirier-Morency from comment #9)
> Created attachment 342977 [details] [review] [review]
> Add 'type_id' to all classes derived from 'GI.BaseInfo'

Why did you partly revert your demanded change? "Add missing inheritence for type derived from 'GI.CallableInfo'"

Will try to incorporate the type_id change. Note that this binding is generated and not written by hand. Therefore applying your patch is not possible.
Comment 11 Guillaume Poirier-Morency 2017-01-05 20:48:50 UTC
Nt(In reply to Rico Tzschichholz from comment #10)
> (In reply to Guillaume Poirier-Morency from comment #7)
> > (In reply to Rico Tzschichholz from comment #6)
> > > Marking an GObject as compact is a no-go.
> > 
> > You've misinterpreted me. I meant using the BaseInfo and it's derivated
> > types as property in a GObject, not having it inherit from GObject.
> 
> I was referring to this proposed change:
> https://bugzilla.gnome.org/attachment.cgi?id=341766&action=diff#a/vapi/
> gobject-introspection-1.0.vapi_sec12
> 
> (In reply to Guillaume Poirier-Morency from comment #9)
> > Created attachment 342977 [details] [review] [review] [review]
> > Add 'type_id' to all classes derived from 'GI.BaseInfo'
> 
> Why did you partly revert your demanded change? "Add missing inheritence for
> type derived from 'GI.CallableInfo'"

My mistake, I was not cautious when merging. You can keep it and move the logic into the metadata if you prefer.

> 
> Will try to incorporate the type_id change. Note that this binding is
> generated and not written by hand. Therefore applying your patch is not
> possible.

Thanks, that's all I need for now!
Comment 12 Rico Tzschichholz 2017-01-05 20:56:27 UTC
Created attachment 342983 [details] [review]
gobject-introspection-1.0: Prettify and fix the whole thing
Comment 13 Rico Tzschichholz 2017-01-05 20:59:44 UTC
This is not pushed yet, and therefore not fixed.
Comment 14 Rico Tzschichholz 2017-01-06 07:44:36 UTC
Attachment 342983 [details] pushed as f5580bc - gobject-introspection-1.0: Prettify and fix the whole thing