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 673422 - Babl C type not accessible to introspection bindings
Babl C type not accessible to introspection bindings
Status: RESOLVED WONTFIX
Product: GEGL
Classification: Other
Component: babl
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Default Gegl Component Owner
Default Gegl Component Owner
Depends on: 675985
Blocks: 645822
 
 
Reported: 2012-04-03 10:18 UTC by Vincent Untz
Modified: 2013-10-09 17:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix build of introspection (619 bytes, patch)
2012-04-03 10:18 UTC, Vincent Untz
none Details | Review

Description Vincent Untz 2012-04-03 10:18:38 UTC
Created attachment 211212 [details] [review]
Fix build of introspection

The build of introspection data for babl fails. This is mostly because the main type in babl is Babl, which is also the namespace. That's confusing for g-i.

I'm attaching a patch that seems to fix things, and that I believe is correct. CC'ing Colin so that he can confirm.

However, what's broken now is the generation of the vala bindings...
Comment 1 Vincent Untz 2012-04-03 10:19:38 UTC
For reference, the error for generating vala bindings is:

Babl-0.1.gir:160.31-160.31: error: `' is not a type
          <type name="Babl" c:type="Babl*"/>
                              ^
Comment 2 Jon Nordby 2012-04-03 10:50:29 UTC
We could let the C type "Babl" have the GI namespace "Babl" and type name "Fish". I think that should be possible to annotate.
It would make this into a standard GI API in terms of naming, and also be extensible in case a C type BablSomething is added.

Øyvind, what do you think?
Comment 3 Øyvind Kolås (pippin) 2012-04-03 11:37:23 UTC
The C type const Babl is used for two different things in the core use of Babl's public API.

1) 

const Babl *babl_format ("R'G'B'A u8"); /* get a singleton reference/pointer to a description of a pixel format representation */

These are the core parts of Babl that need to be bound and understood by bindings to make them useful also for general use with GeglBuffers. Some other things like getting the string name back out from a Babl format would probably be easy once that works.

2)

Less important for bindings, but neccesary to unleash the full power is creating conversions (babl fishes) between these formats and using them:


const Babl *babl_fish (const Babl *src_format, const Babl *dst_format); /* get a singleton reference to a babl conversion */

The fish is used by babl_process (const Babl *fish, void *src_data, void *dst_data, long n_pixels);
Comment 4 Jon Nordby 2012-04-03 15:53:29 UTC
Babl.Fish is not a good name then since only in the more uncommon usecase it represents a conversion/translation. We could annotate it to be renamed to Babl.Babl of course, unless someone has better suggestions?
Comment 5 Jon Nordby 2012-04-12 09:32:32 UTC
Using the "Rename to: BablObject" annotation as described on http://live.gnome.org/GObjectIntrospection/Annotations#Rename_to does not make any difference to the generated .gir.

Manually editing the Babl type record to be "<record name="Object" c:type="Babl">", and its use to be  and <type name="Object" c:type="Babl*"/>, makes the .typelib compile successfully.
Comment 6 Jon Nordby 2012-04-12 09:34:28 UTC
Another possibly related issue is that for all the methods for the Babl* c-type, the first character is stripped from the name in the GIR:

<method name="alette_reset" c:identifier="babl_palette_reset">
Comment 7 Jon Nordby 2012-04-12 09:43:33 UTC
Review of attachment 211212 [details] [review]:

When applying this patch, the C functions operating on or creating a Babl* are no longer recognized as methods and constructors.
Comment 8 Jon Nordby 2012-07-29 13:15:05 UTC
commit dc754cdd46bf89506ccbacd9e1edf4f18319ba6f
Author: Jon Nordby <jononor@gmail.com>
Date:   Fri Jul 27 22:00:46 2012 +0200

    Bug 673422 - Babl C type not accessible to introspection bindings
    
    https://bugzilla.gnome.org/show_bug.cgi?id=673422
    Annotate Babl C type to be Babl.Object in GIR using the
    "rename to" annotation in GI 1.33.5+. For earlier versions,
    use a static .gir file to achieve the same.
Comment 9 Jon Nordby 2012-11-19 17:29:27 UTC
Not fixed as the dependent fixes were reverted in GI.
Comment 10 Daniel Sabo 2013-10-09 16:54:44 UTC
All instances of Babl * now have alternate wrappers in GEGL's bindings, so not having Babl bindings is no longer an impediment to using GEGL from Python.

Is there a real use case for introspecting Babl outside of GEGL? It seems like a lot more pain than it's worth.
Comment 11 Jon Nordby 2013-10-09 17:45:02 UTC
No, probably not, closing. Thanks for fixing the GEGL introspection!
We should rip out the --enable-introspection in Babl automake, if not done already.