Re: Add GtkRadioGroup?



On Fri, 2010-10-29 at 20:39 +0900, Tristan Van Berkom wrote:
> So I thought maybe it would be nice if one could use a GtkActionGroup
> for radio buttons/menuitems implicitly and hide the GSList, with some
> semantics to the creation of radio buttons/menutiems that takes care
> or creating an action (if one is not already associated to the said
> proxy widget) and just having the user *always use an action group* to
> put radio widgets together.
> 
> Maybe that's not so pretty as an implementation (personally I think 
> it would be nicer if ActionGroups were typed, such as
> GtkRadioActionGroup/GtkToggleActionGroup etc, that would be nicer).
> 
> Currently the way things are setup however, actions have a way of
> updating toggle states of radio widgets, and so do radio widgets
> themselves... this works but is a little flaky by design 
> (i.e. both groups can exist and end up executing, probably making 
> the same result so long as the groups are holding proxies of the 
> same actions)... I'm just saying we should probably drop the 
> association at the GtkWidget level and only drive the radio widget
> relationship at the GtkAction level (with some pretty code that
> hides the fact that its done with a GtkActionGroup for users that
> just dont want to use actions by hand).

The "radio semantics" implementation really has to be implemented in the
button itself, with the radio group object being very dumb. We can't
move the radio behaviour into the group, because the implementation in
the button needs to be very careful about when and how signals are
emitted to protect against reentrancy issues and having the widgets in a
sane state during the emissions. (Basically, all the widget+group
changes has to happen atomically before we emit the signals in the right
order.)

Additionally, I don't think enforcing a mixin of GtkAction in the pure
widget implementation would make the widget API easier to understand or
use, nor easier to implement.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
       alexl redhat com            alexander larsson gmail com 
He's an old-fashioned shark-wrestling stage actor plagued by the memory of his 
family's brutal murder. She's a supernatural streetsmart archaeologist from a 
secret island of warrior women. They fight crime! 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]