Re: Add GtkRadioGroup?
- From: Tristan Van Berkom <tristanvb openismus com>
- To: Alexander Larsson <alexl redhat com>
- Cc: "gtk-devel-list gnome org" <gtk-devel-list gnome org>
- Subject: Re: Add GtkRadioGroup?
- Date: Fri, 29 Oct 2010 20:39:05 +0900
On Fri, 2010-10-29 at 08:22 +0200, Alexander Larsson wrote:
> On Fri, 2010-10-29 at 12:43 +0900, Tristan Van Berkom wrote:
> > On Thu, 2010-10-28 at 22:38 +0200, Alexander Larsson wrote:
> > > One thing I remember being really confused about when learning gtk+ is
> > > the GSList * usage for the group in GtkRadioButton. We have added some
> > > scaffolding now that makes this somewhat better, but whats the chance of
> > > actually fixing this by adding a real GtkRadioGroup class and using it
> > > for radio buttons/menus/toolitems/actions?
> > >
> > > It'll be a slight api break, but it should be trivial to fix up any
> > > problems and the compiler should catch them all.
> > >
> > > In addition to removing the GSList crap we can also add proper signals
> > > for when the group contents changes (added/removed items) and a single
> > > signal for the group when we get a new active item.
> > >
> > > Below is a small example patch, mostly just compile tested. If there is
> > > interest in doing this I'll try to find some time to do a full patch.
> > >
> > > Opinions?
> >
> > Hi,
> > I like the idea of not using the GSList too.
> >
> > But I wonder, don't we already accomplish this with
> > GtkRadioAction ?
> >
> > I'm not sure the two entities would play nicely together
> > either, maybe it makes sense to deprecate or even remove
> > GSList interaction and just converge towards usage of
> > a GtkRadioAction.
>
> I'm not sure what you propose at all. GtkRadioAction and GtkRadioGroup
> are different concepts. GtkRadioAction represent a single action item
> with radio semantics, GtkRadioGroup is what chains a set of items with
> radio semantics together.
Ah sorry I missed that there was not such a semantic with actions,
only that when adding radio actions to a group implicitly connects
the gslist under the hood.
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).
Cheers,
-Tristan
>
> GtkRadioGroup would replace the GSList in:
>
> GSList *gtk_radio_action_get_group (GtkRadioAction *action);
> void gtk_radio_action_set_group (GtkRadioAction *action,
> GSList *group);
>
> just like it would in GtkRadioButton.
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]