Re: Help on GObject Introspection Annotations



In GdaNumeric, we added accesors to fields in the struct.

I think you have a GObject implementation. Your way is the best: add
properties to access to fields.

GdaNumeric is a struct with some fields easy to modify directly from
Python, like the integer ones, but the string one is not handle by
Python by default because could be very different per case. Then we
added some API to access to struct members (all), and now this struct
is considered opaque.

For new implementations I recomend to hide struct definition in the
*.c and just use in the header:

typedef _MyStruct MyStruct;

This hides internal definition and forces the developer to use the
API. This way GObject Introspection will always make bindings to
modify struct fields as expected by the implementator and makes very
easy to automatically generate GIR files with the required API.

2011/12/2 Tal Liron <tal liron gmail com>:
> Thanks!
>
> I solved it in my software by wrapping fields in properties. That way C code
> can still access the fields directly, while Python can use set_property().
>
> -Tal
>
> On 12/02/2011 01:18 PM, Daniel Espinosa wrote:
>
> No one have sent any response message.
>
> I've added this annotations to GdaNumeric, but GIR and Vala bindings
> make no difference. Both use GdaNumeric, as declared on GDA, as a
> GBoxed and use g_boxed_copy and g_boxed_free functions.
>
> May be this help was added but not implemented jet.
>
> 2011/12/2 Tal Liron <tal liron gmail com>:
>
> Hello Daniel, and sorry for writing to you directly, but I can't find a way
> to respond to an archived message on the mailing list.
>
> Did you ever found a solution to this issue you posted?
>
> https://mail.gnome.org/archives/gtk-list/2011-October/msg00049.html
>
> Thanks!
>
> -Tal
>
>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]