Re: Design problem with radio items



Michael Meeks <michael helixcode com> writes:

>         That would be great; here are some things to bear in mind

Hi Michael,

> * As you suggest the group name should be put in the command namespace and
> a node created for it.
> 
> * since we currently have a way of setting the state of the items by
> putting state="1" on the individual radio items, how do we sync this state
> with the group state ?

I think we can do this on the command node, for instance:

    <cmd name="Interpolation" type="radio" state="bilinear"/>

    <menuitem name="InterpolationNearest" type="radio" group="Interpolation"/>
    <menuitem name="InterpolationTiles" type="radio" group="Interpolation"/>
    <menuitem name="InterpolationBilinear" type="radio" group="Interpolation"/>
    <menuitem name="InterpolationHyperbolic" type="radio" group="Interpolation"/>

I think we should use the id of the item to point to the command node, but
in the following way:

* if no id field is present, then there is no command note and the component
  will listen on state changes (the old setup).

* if the id field is present, but the empty string, use the group name.

* otherwise, use the id field.

In addition to this, I think we should also allow verbs on the menuitem:

    <menuitem name="InterpolationBilinear" type="radio" group="Interpolation"
        id="" verb=""/>

    would case the state of `Interpolation' to be changed but also the verb
    "InterpolationBilinear" to be executed.

When you want to set the state, you can do this on the command node, for
instance set the state of the "Interpolation" node to "InterpolationBilinear".

> * we need to keep track of the state when items are de-merged from a radio
> group; it is quite possible for a radio group to contain items from
> different components. Hence we need to attach to the destroy signal on the
> group and somehow switch to another item if we are destroyed.
>   
> * the value to set the state of the group name command should be the id /
> verb of the item.

Hmm, I think we should use verb/name for it (so verb if present, otherwise
the name). This way we can reserve the id field to point to the command node
(and thus allow the command node be different from the radio group).

-- 
Martin Baulig
martin gnome org (private)
baulig suse de (work)




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