Re: EggMenu

On Sun, 2002-05-26 at 09:30, James Henstridge wrote:
> I have been working on some new menu handling code for a while, and 
> would be interested in some input from some of the people who might end 
> up using it.  If anyone wants to try it out, simply checkout and build 
> libegg.  Then run the test-merge program in the libegg/menu subdirectory.

I have given it a quick look; I include some comments here.

> This new menu handling code makes use of a lot of the ideas of the 
> bonobo UI handler code, but only relies on gtk+ (version 2.0).  I have 
> tried to design things so that bonobo could build on top of it for its 
> remote component menu handling (the aim being to unify menu handling of 
> gtk, gnome and bonobo apps, so people don't need to rewrite their menu 
> code to add gnome or bonobo support).  Some  of the main features include:

Maybe this should be Cc:ed to gnome-components-list?

>     * concept of Action objects.  An action combines menu label, icon,
>       tooltip, toolbar label, callback, etc.  Any number of proxy menu
>       items and toolbar buttons can be created for an action, which
>       reflect the state of the action (ie. if you change the label or
>       keybinding for an action, all proxies reflect that change
>       automatically).  There are special action types for toggle actions
>       and actions that are part of a radio group.

I don't like the way the callback data gets passed in an array of
EggActionEntries.  When that happens, it's always annoying (as it often
means that you have to fill in the array with data that you only have at
runtime, and that sucks.)

Rather, I would just have a single piece of data that gets passed to all
the callbacks.  Like

	void egg_action_group_add_entries (EggActionGroup *group,
					   const EggActionGroupEntry *entries,
					   int num_entries,
					   void *data);

Maybe entry-specific data is still useful (for using just one callback
for multiple operations of the same kind), but you really want the
global closure pointer.

>     * Menu/toolbar descriptions defined in XML files.  The format is a
>       subset of the bonobo UI XML format.  Keybindings are not handled
>       in the XML, but instead use the GTK accel map, and menu labels,etc
>       are taken from the action objects.  In fact, no user visible
>       strings are included in the XML file.

I am not sure how I feel about these.  The nice thing about the original
Bonobo UI handler is that the UI designer can tweak the menus without
touching the code at all...

On the other hand, the Bonobo UI handler XML files have never been very
nice to deal with.  (Especially because I always found the way paths
work kinda confusing and undocumented.)

>     * Ability to merge multiple XML user interface files together (with
>       support for placeholders).  I haven't implemented the toolbar
>       handling in the merge code yet though.

One thing that we should keep in mind is that, in the end, the layout of
the toolbars should be user-tweakable.  Does the current design allow
for that?

-- Ettore

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