Index: xfconf/xfconf.symbols =================================================================== --- xfconf/xfconf.symbols (revision 27394) +++ xfconf/xfconf.symbols (working copy) @@ -99,5 +99,6 @@ #if IN_SOURCE(__XFCONF_BINDING_C__) xfconf_g_property_bind xfconf_g_property_unbind +xfconf_g_property_unbind_all #endif #endif Index: xfconf/xfconf-binding.c =================================================================== --- xfconf/xfconf-binding.c (revision 27394) +++ xfconf/xfconf-binding.c (working copy) @@ -86,6 +86,16 @@ GObject *where_the_object_was) { XfconfGBinding *binding = data; + GSList *bindings = g_object_steal_data(G_OBJECT(binding->object), + I_("--xfconf-g-bindings")); + bindings = g_slist_remove(bindings, binding); + + if(bindings) { + g_object_set_data_full(G_OBJECT(binding->object), + I_("--xfconf-g-bindings"), + bindings, (GDestroyNotify)g_slist_free); + } + binding->channel = NULL; xfconf_g_binding_free(binding); } @@ -95,16 +105,6 @@ GObject *where_the_object_was) { XfconfGBinding *binding = data; - GSList *bindings = g_object_steal_data(G_OBJECT(binding->channel), - I_("--xfconf-g-bindings")); - - bindings = g_slist_remove(bindings, binding); - if(bindings) { - g_object_set_data_full(G_OBJECT(binding->channel), - I_("--xfconf-g-bindings"), - bindings, (GDestroyNotify)g_slist_free); - } - binding->object = NULL; xfconf_g_binding_free(binding); } @@ -254,12 +254,12 @@ G_CALLBACK(xfconf_g_binding_object_property_changed), binding); - bindings = g_object_get_data(G_OBJECT(channel), I_("--xfconf-g-bindings")); + bindings = g_object_get_data(G_OBJECT(object), I_("--xfconf-g-bindings")); if(bindings) - bindings = g_slist_append(bindings, binding); + bindings = g_slist_prepend(bindings, binding); else { - bindings = g_slist_append(bindings, binding); - g_object_set_data_full(G_OBJECT(channel), I_("--xfconf-g-bindings"), + bindings = g_slist_prepend(bindings, binding); + g_object_set_data_full(G_OBJECT(object), I_("--xfconf-g-bindings"), bindings, (GDestroyNotify)g_slist_free); } @@ -286,14 +286,14 @@ GObject *object, const gchar *object_property) { - GSList *bindings = g_object_steal_data(G_OBJECT(channel), + GSList *bindings = g_object_steal_data(G_OBJECT(object), I_("--xfconf-g-bindings")); GSList *l; for(l = bindings; l; l = l->next) { XfconfGBinding *binding = l->data; - if(object == binding->object + if(channel == binding->channel && !strcmp(xfconf_property, binding->xfconf_property) && !strcmp(object_property, binding->object_property)) { @@ -304,12 +304,34 @@ } if(bindings) { - g_object_set_data_full(G_OBJECT(channel), I_("--xfconf-g-bindings"), + g_object_set_data_full(G_OBJECT(object), I_("--xfconf-g-bindings"), bindings, (GDestroyNotify)g_slist_free); } } +/** + * xfconf_g_property_unbind_all: + * @object: A #GObject. + * + * Unbinds all Xfconf channel bindings (see xfconf_g_property_bind()) + * to the #GObject. + **/ +void +xfconf_g_property_unbind_all(GObject *object) +{ + GSList *bindings = g_object_steal_data(G_OBJECT(object), + I_("--xfconf-g-bindings")); + GSList *l; + if(bindings) { + for(l = bindings; l; l = l->next) + xfconf_g_binding_free(l->data); + g_slist_free(bindings); + } +} + + + #define __XFCONF_BINDING_C__ #include "common/xfconf-aliasdef.c"