GNOME Bugzilla – Bug 775812
gobject-introspection-1.0 bindings are terribly broken
Last modified: 2017-01-06 07:44:44 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.
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
Created attachment 341724 [details] [review] gobject-introspection-1.0: Prettify and fix the whole thing
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.
Created attachment 341768 [details] [review] Add missing inheritence for type derived from 'GI.CallableInfo'
Created attachment 342851 [details] [review] gobject-introspection-1.0: Prettify and fix the whole thing
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.
(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.
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.
Created attachment 342977 [details] [review] Add 'type_id' to all classes derived from 'GI.BaseInfo'
(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.
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!
Created attachment 342983 [details] [review] gobject-introspection-1.0: Prettify and fix the whole thing
This is not pushed yet, and therefore not fixed.
Attachment 342983 [details] pushed as f5580bc - gobject-introspection-1.0: Prettify and fix the whole thing