FrapMenu menu/item ordering

Stephan Arts psybsd at gmail.com
Thu Feb 22 09:05:16 CET 2007


On 2/21/07, Brian J. Tarricone <bjt23 at cornell.edu> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Wed, 21 Feb 2007 20:42:36 +0100 Stefan Stuhr wrote:
>
> > ons, 21 02 2007 kl. 20:19 +0100, skrev Jannis Pohlmann:
> > > They're unsorted as the order is unimportant for internal use.
> > > Comparing them by names is really easy with the help of a
> > > GCompareFunc as you can see above.
> >
> > I will admit that I don't know the fd.org menu standard, but if the
> > implementation in GNOME follows the standard (I do believe that it
> > does), then the order does matter - and not necessary a sorted order.
>
> Agreed.  If FrapMenu can't preserve the order from the .menu file,
> that's a *huge* limitation.  How will people make menus with
> arbitrarily-ordered items?

Sorry to disappoint you there, but the XML standard does not force
siblings to be entered in a specific order. As such, there is no XML
parser which will guarantee you that xml-nodes are returned in the
order they come up in the file. And they do not have too, it is not
part of XML-spec itself.

As a consequence of this, it is impossible for FrapMenu (or any other
application which uses XML) to preserve the order since it is not even
certain that the order in which the nodes are presented to him is the
order in which they where inside the file.

On a side-node, usually it does work this way, but we cannot rely on this.

- Stephan



More information about the Xfce4-dev mailing list