Re: What gives us the macro GSEAL()?



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Grzegorz Kuczyński a écrit :
> A. Walton pisze:
>> 2009/4/12 A. Walton <awalton ubuntu com>: ...
>>
>> gtk_window_set_title() is inside of gtk+ and won't need to
>> change. The macro is to prevent external applications from doing
>> window->title = whatever; and instead applications should (and
>> will be forced to use) gtk_window_set_title().
>>
> "will be forced to use " - how?
Simply because access to window->title will not be possible any more,
as I explained in another mail.
For now, if you define GSEAL_ENABLE when compiling an application
accessing window->title, it will fail since window->title doesn't
exist: it is renamed window->_g_sealed__title. But you have not to
know this other name, as you haven't to know window->title: you
should, must, [insert here the strongest word you want] use accessors,
then in window's title case, gtk_window_[set|get]_title().
And in future releases, all private members may become really private,
meaning there will not be any other way than accessors to access
private members.

All this is because the object can't be notified of a modification of
one of it's properties if it is not done by the GObject's mechanism,
or at least an object's function. And if an object is not notified of
a change, it can't do the work it should do when this change happen,
e.g. for the window's title example, update the window's titlebar.
And using only GObject's property mechanism allows a lot of nice
features like use of the notify::property-name signal and so on.

Regards,
Colomban
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAknjNqsACgkQyqbACDEjVWjMYwCdHJD8iKtgRZmOSE3xqzp3gZJ0
yTAAoLFBSCzgofmkcvxoj/jjIGh3jY6S
=3hOZ
-----END PGP SIGNATURE-----




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