Top |
TeplSettingsBindingGroupTeplSettingsBindingGroup — A group of GSettings bindings |
TeplSettingsBindingGroup is a small utility to call g_settings_unbind()
on a
group of properties (on the same GObject).
The documentation of g_settings_unbind()
says that bindings are automatically
removed when the object is finalized. The purpose of
TeplSettingsBindingGroup is to unbind the settings in
instead.
Setting a property while an object has already been disposed but not
finalized is usually not well tested, and can result to crashes, so it is
more robust to unbind the settings in dispose()
.dispose()
To achieve the same, you can also write a list of g_settings_unbind()
calls
at the appropriate place. But where g_settings_bind()
(or similar) and
g_settings_unbind()
need to be called are at different places so it is more
error-prone to maintain. With this utility, tepl_settings_binding_group_add()
is called at the same place as g_settings_bind()
.
TeplSettingsBindingGroup *
tepl_settings_binding_group_new (void
);
[skip]
Since: 6.11
void
tepl_settings_binding_group_free (TeplSettingsBindingGroup *group
);
Frees a TeplSettingsBindingGroup instance.
[skip]
Since: 6.11
void tepl_settings_binding_group_add (TeplSettingsBindingGroup *group
,const gchar *property_name
);
Adds property_name
to group
.
Each time that you call g_settings_bind()
(or similar), you should call this
function too.
Since: 6.11
void tepl_settings_binding_group_unbind (TeplSettingsBindingGroup *group
,GObject *object
);
Calls g_settings_unbind()
on object
for all properties that have been added
to group
.
This function is intended to be called in
.dispose()
Since: 6.11