The property binding code works great, but it would be useful to unbind all properties on an object. Let me explain the use case: With property binding together with Schemes/devices you have to remember the previous name when unbinding. Example for the mouse settings: 1) Bind a property to for a device: g_snprintf (property, sizeof (property), "/%s/Acceleration", device_name); xfconf_g_property_bind (channel, property, G_TYPE_DOUBLE, adjustment, "value"); gchar *current_device_name = device_name; 2) User selects another device in the list: g_snprintf (property, sizeof (property), "/%s/Acceleration", *current_device_name); xfconf_g_property_unbind (channel, property, adjustment, "value"); g_snprintf (property, sizeof (property), "/%s/Acceleration", device_name); xfconf_g_property_bind (channel, property, G_TYPE_DOUBLE, adjustment, "value"); g_free (current_device_name); current_device_name = device_name; As you can see you need to remember the previous device name to unbind, while I only want to unbind all the binding on the object. It would be nice to unbind all properties on an object using a single command: void xfconf_g_property_unbind_all (XfconfChannel *channel, GObject *object); This way you can easily change bindings when the user selects another device: xfconf_g_property_unbind_all (channel, adjustment); g_snprintf (property, sizeof (property), "/%s/Acceleration", device_name); xfconf_g_property_bind (channel, property, G_TYPE_DOUBLE, adjustment, "value");
Yeah, good idea. Do you care about the XfconfChannel? I mean, does it make as much sense just to take a GObject and unbind all props on that object regardless of what channel it's bound to?
Not really, but you've attached the binding data to the channel, so I though...
Created attachment 1750 v1 Patch to implement xfconf_g_property_unbind_all(GObject *object). Changes: * New function xfconf_g_property_unbind_all. * Bindings list is now set to the object, not the channel. * Changed an append to prepend, here it can't hurt. Normal binding seems to work fine, haven't tried unbinding since we don't use it anywhere atm. Will write some code to test it tomorrow if you want to change it this way.
Looks good, go ahead. Please regen the docs and check in any needed .sgml changes as well. If you're not set up with gtk-doc and it's a pain, don't worry about it.
Ok, will commit it tonight the patch after I've tested the unbindings. I'll attach a patch here (after the commit) with a test for (un)bindings, so you can take a look at it.
Err. good morning, try 2: Ok, will commit the patch tonight after I've tested the unbindings.
Tested the code and committed in revision 27399. Will post a patch to test the bindings in another bug.