Xfconf-GObject Binding
3
XFCONF Library

# Xfconf-GObject Binding

Functions to bind Xfconf properties to GObject properties

## Synopsis

    gulong              xfconf_g_property_bind              (XfconfChannel *channel,
                                                             const gchar *xfconf_property,
                                                             GType xfconf_property_type,
                                                             gpointer object,
                                                             const gchar *object_property);
    gulong              xfconf_g_property_bind_gdkcolor     (XfconfChannel *channel,
                                                             const gchar *xfconf_property,
                                                             gpointer object,
                                                             const gchar *object_property);
    void                xfconf_g_property_unbind            (gulong id);
    void                xfconf_g_property_unbind_by_property
                                                            (XfconfChannel *channel,
                                                             const gchar *xfconf_property,
                                                             gpointer object,
                                                             const gchar *object_property);
    void                xfconf_g_property_unbind_all        (gpointer channel_or_object);

## Description

Often it may be useful to bind an Xfconf property to a GObject property. Settings dialogs often display the current value of an Xfconf property, and a user may edit the value to change the value in the Xfconf store. If the Xfconf property changes outside the settings dialog, the user will usually want to see the settings dialog automatically update to reflect the new value.

With a single line of code, Xfconf's binding functionality can automate all this.

## Details

### xfconf_g_property_bind ()

    gulong              xfconf_g_property_bind              (XfconfChannel *channel,
                                                             const gchar *xfconf_property,
                                                             GType xfconf_property_type,
                                                             gpointer object,
                                                             const gchar *object_property);

Binds an Xfconf property to a GObject property. If the property is changed via either the GObject or Xfconf, the corresponding property will also be updated.

Note that `xfconf_property_type` is required since `xfconf_property` may or may not already exist in the Xfconf store. The type of `object_property` will be determined automatically. If the two types do not match, a conversion will be attempted.

`channel` :

  An XfconfChannel.

`xfconf_property` :

  A property on `channel`.

`xfconf_property_type` :

  The type of `xfconf_property`.

`object` :

  A GObject.

`object_property` :

  A valid property on `object`.

Returns :

  an ID number that can be used to later remove the binding.

### xfconf_g_property_bind_gdkcolor ()

    gulong              xfconf_g_property_bind_gdkcolor     (XfconfChannel *channel,
                                                             const gchar *xfconf_property,
                                                             gpointer object,
                                                             const gchar *object_property);

Binds an Xfconf property to a GObject property of type GDK_TYPE_COLOR (aka a GdkColor struct). If the property is changed via either the GObject or Xfconf, the corresponding property will also be updated.

This is a special-case binding; the GdkColor struct is not ideal as-is for binding to a property, so it is stored in the Xfconf store as four 16-bit unsigned ints (red, green, blue, alpha). Since GdkColor (currently) only supports RGB and not RGBA, the last value will always be set to 0xFFFF.

`channel` :

  An XfconfChannel.

`xfconf_property` :

  A property on `channel`.

`object` :

  A GObject.

`object_property` :

  A valid property on `object`.

Returns :

  an ID number that can be used to later remove the binding.

### xfconf_g_property_unbind ()

    void                xfconf_g_property_unbind            (gulong id);

Removes an Xfconf/GObject property binding based on the binding ID number. See `xfconf_g_property_bind()`.

`id` :

  A binding ID number.

### xfconf_g_property_unbind_by_property ()

    void                xfconf_g_property_unbind_by_property
                                                            (XfconfChannel *channel,
                                                             const gchar *xfconf_property,
                                                             gpointer object,
                                                             const gchar *object_property);

Causes an Xfconf channel previously bound to a GObject property (see `xfconf_g_property_bind()`) to no longer be bound.

`channel` :

  An XfconfChannel.

`xfconf_property` :

  A bound property on `channel`.

`object` :

  A GObject.

`object_property` :

  A bound property on `object`.

### xfconf_g_property_unbind_all ()

    void                xfconf_g_property_unbind_all        (gpointer channel_or_object);

Unbinds all Xfconf channel bindings (see `xfconf_g_property_bind()`) to `object`. If `object` is an XfconfChannel, it will unbind all xfconf properties on that channel. If `object` is a regular GObject with properties bound to a channel, all those bindings will be removed.

`channel_or_object` :

  A GObject or XfconfChannel.