Function

Adwbind_property_to_css_class

unstable since: 1.10

Declaration [src]

AdwCssClassBinding*
adw_bind_property_to_css_class (
  GObject* source,
  const char* source_property,
  GtkWidget* target,
  const char* target_css_class,
  GBindingFlags flags
)

Description [src]

Creates a binding between a property on source and a CSS class on target.

Whenever source_property is changed the target_css_class is toggled either on or off on target using the boolean value of source_property.

For instance:

adw_bind_property_to_css_class (action, "active", widget, "active-widget", 0);

will result in the active-widget CSS class on the widget instance being applied when active is TRUE, and active-widget being removed when active is FALSE.

The binding will automatically be removed when either the source or target instances are finalized. To remove the binding without affecting the source or target, call g_object_unref() on the returned binding. It is recommended to only call g_object_unref() when it is clear that both source and target will outlive the binding.

This function is not thread safe. A source can have multiple bindings.

See also: adw_bind_property_to_css_class_full().

Available since: 1.10

Parameters

source

Type: GObject

The source object.

The data is owned by the caller of the function.
source_property

Type: const char*

The property on source to bind.

The data is owned by the caller of the function.
The value is a NUL terminated UTF-8 string.
target

Type: GtkWidget

The target widget.

The data is owned by the caller of the function.
target_css_class

Type: const char*

The CSS class on target to bind.

The data is owned by the caller of the function.
The value is a NUL terminated UTF-8 string.
flags

Type: GBindingFlags

Flags to pass to self.

Return value

Type: AdwCssClassBinding

The new binding.

The data is owned by the called function.