FrapMenu menu/item ordering

Jannis Pohlmann jannis at
Wed Feb 21 22:37:26 CET 2007

On Wed, 21 Feb 2007 12:41:28 -0800, Brian J. Tarricone wrote:

> On Wed, 21 Feb 2007 20:19:55 +0100 Jannis Pohlmann wrote:
> > On Tue, 20 Feb 2007 17:49:44 -0800, Brian J. Tarricone wrote:
> >
> > > How would I do this?  frap_menu_get_menus() and
> > > frap_menu_get_items() returns the list of menus and items,
> > > respectively, but there doesn't seem to be a way to create a mixed
> > > ordering.  So I either end up with all the menus, then all the
> > > items, or the reverse, depending on the order I add them in my
> > > code.
> >
> > True.
> [...]
> > I know this is a little messy, but it should work. As I don't treat
> > menus and items as XML nodes like gnome-menus does, there's no easy
> > way to mix them (unless I implement a special node interface).
> Would maintaining a separate GList/GSList for the FrapMenuItem order
> in each FrapMenu be too much overhead, both speed- and memory-wise?

It's not a question of memory overhead. Instead, it's rather a question
of the concept behind it. There's no way to load files spread across
the filesystem in a special order (except alphabetical, which also is
the default behaviour suggested by the spec). Menus handle all of them
in the same way. They're therefor stored in a pool (basically a hash
table with (desktop-id => menu item) mapping).

The only way to have a special order (and separators) is using the
<Layout> element - which is not supported by FrapMenu yet. I haven't
planned how to implement this, but I could imagine providing a

  FrapMenuLayout frap_menu_get_layout (FrapMenu *menu);

function in combination with a FrapMenuLayout class containing menus,
separators and items in order according to <Layout> elements. If you
want to have special elements placed on top and separated like in the
current menu, you could then just do:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <>

More information about the Xfce4-dev mailing list