I'm adding GObject introspection to an existing GObject based library (libInstPatch) written in C. For this purpose I am willing to update the C API to make a good binding, even if it breaks backwards compatibility (though I'd like to avoid that if possible).
I've gone through and annotated the majority of the API and am able to load the binding in Python. However, I noticed an issue with an enum, which looks like the following:
typedef enum
{
IPATCH_SAMPLE_INVALID = 0,
IPATCH_SAMPLE_8BIT = 1,
IPATCH_SAMPLE_16BIT = 2,
IPATCH_SAMPLE_24BIT = 3,
IPATCH_SAMPLE_32BIT = 4,
IPATCH_SAMPLE_FLOAT = 5,
IPATCH_SAMPLE_DOUBLE = 6,
IPATCH_SAMPLE_REAL24BIT = 7
} IpatchSampleWidth;
The enum ends up being Ipatch.SampleWidth, which is as expected. However, the values turn in to 8BIT, 16BIT, 24BIT, and 32BIT which are invalid Python variable names. It seems like g-ir-scanner should have warned about this.
Any tips on the best way to fix these? For the moment I changed them to read IPATCH_SAMPLE_BIT8 (BIT8), etc. and added #defines for the old names for backwards compatibility with the C API, but I was wondering if there was a better way. I tried rename-to, but that doesn't seem to work on a per enum value basis.