Re: property API vs fields



> On Sun, 6 Aug 2006, Steph Fox wrote:
>
>> Hi GTK people,
>>
>> The PHP-GTK doc team have hit a point of confusion over the property API
>> in
>> GTK 2, mostly because publicly accessible fields hanging over from GTK 1
>> are
>> still publicly accessible. We don't know whether to promote the use of
>> *_get_|set_property() or not, and to some extent that depends on whether
>> it
>> will eventually be enforced by the GTK+ team.

I mean to reply to this earlier.

GTK+ is very unlikely to change those struct fields, even if they could do
so while keeping the struct size the same. It would just be too risky
because someone's hack probably depends on the non-public API. The
situation is avoided with new code by using the GObject "private" data.

Do use the property API wherever it exists. It does more than just
setting/getting a struct field.

However, some of those struct fields really are public. I forget exactly
what the rule is, and I can't find the email where this was stated. It's
either
- They are public unless marked private.
or
- They are private unless marked public.

Whatever the rule is, it's probably not followed perfectly. A list of
structs where this isn't clear would probably help people to improve the
documentation.

Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




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