TeplSettingsBindingGroup

TeplSettingsBindingGroup — A group of GSettings bindings

Functions

Types and Values

Includes

#include <tepl/tepl.h>

Description

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 dispose() 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().

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().

Functions

tepl_settings_binding_group_new ()

TeplSettingsBindingGroup *
tepl_settings_binding_group_new (void);

[skip]

Returns

a new TeplSettingsBindingGroup instance.

[transfer full]

Since: 6.11


tepl_settings_binding_group_free ()

void
tepl_settings_binding_group_free (TeplSettingsBindingGroup *group);

Frees a TeplSettingsBindingGroup instance.

[skip]

Parameters

group

a TeplSettingsBindingGroup.

[nullable]

Since: 6.11


tepl_settings_binding_group_add ()

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.

Parameters

group

a TeplSettingsBindingGroup.

 

property_name

the name of a GObject property.

 

Since: 6.11


tepl_settings_binding_group_unbind ()

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().

Parameters

group

a TeplSettingsBindingGroup.

 

object

a GObject.

 

Since: 6.11

Types and Values

TeplSettingsBindingGroup

typedef struct _TeplSettingsBindingGroup TeplSettingsBindingGroup;