Adding an xfconf enum property and binding it to multiple ui radio buttons

Sparr sparr0 at gmail.com
Mon Sep 5 09:08:19 CEST 2022


Hello. This is my first post to the list, and my first time attempting
to do development related to Xfce. For my first foray into the
codebase, I am trying to implement a new feature in
xfce4-pulseaudio-plugin, the panel plugin that commonly provides
volume indication and control.

My new feature will allow the user to configure the behavior when the
panel icon is middle clicked. Specifically, instead of the current
behavior of toggling the volume mute, I want to cycle through output
devices. I was able to get that specific functionality working without
much trouble, and while I would be open to code review now, I expect
I'll get plenty of feedback on that when I have this all ready to
submit a patch.

Here's the code I have so far. The link goes directly to a problematic
location, but the previous two commits cover all the code changes I've
made so far. https://github.com/sparr/xfce4-pulseaudio-plugin/blob/8a8dc20f300ed86ed3abeb8b66b86fe9870b621c/panel-plugin/pulseaudio-dialog.c#L291

Where I've hit a roadblock is in trying to add a configuration
property to choose between the two behaviors, and present that in the
panel properties GUI. I chose to present the choices as radio buttons,
although I understand that a menu or radiomenu could also work. I can
see and interact with the radio buttons, but when I select them I see
an error in the panel output:
"(wrapper-2.0:492812): xfconf-CRITICAL **: 01:11:14.622:
IA__xfconf_channel_set_property: assertion 'XFCONF_IS_CHANNEL(channel)
&& property && G_IS_VALUE(value)' failed". I also note that
xfconf-query does not show the existence of the new property
("middle-click-action"). So, my first request for assistance is in
figuring out what I've done wrong such that the property isn't being
created or updated.

My second concern is regarding the very brute force approach I've
taken to the GBinding between the radio buttons and the enum property.
I wasn't able to find an example of binding multiple UI elements to
the same property. It feels like there should be a straightforward way
to bind radio buttons to an enum, or checkbuttons to flags. I would
appreciate any guidance on this front, although I suspect I can do
better on my own if I spend some time building a custom binding
implementation.

Thanks in advance for any help!


More information about the Xfce4-dev mailing list