Bonobo Menu stuff.




Hello everyone,

      I have been working on the menu/toolbar functionality for
Bonobo, and before I get too far, I'd like some comments on the API
I've defined.  There are two main problems that this API is trying to
solve:

    1. With Bonobo, we will have components embedding themselves
       into applications, and the embedded component's menus and
       toolbar items will have to merge with those of the container.
       Components might, in fact, be nested inside each other inside a
       container.  All of these cases must be handled.  And of course,
       notification of menu/toolbar item activation must be propagated
       down to the component which owns the activated UI item.

       And merging is not the only issue which must be addressed.  An
       embedded component has to be able to manipulate menu items
       which are in a container in a separate process.  So the API I
       define has to have routines which provide remote access to most
       of the (important) things you can do by having local access to
       the MenuItem/ToolbarItem widgets.

    2. The current API for defining and manipulating menu and
       toolbar items is inadequate.  So while I'm solving problem #1,
       I'd like my new API to address problems people have had with
       the current API.

The basic idea which Miguel and I came up with is that every
component, container or containee, will support a GnomeUIHandler CORBA
interface.  The GnomeUIHandler will act as a server which handles all
of the menu/toolbar issues for that component.  So everyone, all the
way from the top-level container to the most deeply nested component,
will talk to a GnomeUIHandler service to manipulate their menu and
toolbar items.

	GnomeUIHandler services on nested components will forward
method calls up to the next highest GnomeUIHandler, until the message
has reached the top-level GnomeUIHandler, which will manipulate the
actual menu/toolbar widgets.  So for example, let's say AbiWord[1] is
running and has an embedded Gnumeric BonoboObject.  And let's say
Gnumeric has an embedded Guppi BonoboObject, which has just been given
focus and wants to add a new menu item called "File/Print plot"[2].
Guppi calls:

	gnome_ui_handler_menu_add (guppi_uih, "File/Print plot", itemdata);

where 'itemdata' is a structure container information about the menu
item, such as its label, pixmap, callback, callback closure data, and
so forth.

	Guppi's GnomeUIHandler service knows that it is not the
top-level UIHandler in the chain, but it has a pointer to the
UIHandler interface for Gnumeric.  So Guppi calls a method on
Gnumeric's GnomeUIHandler, telling it about the new menu item which
should created.  Gnumeric forwards the request to AbiWord's
GnomeUIHandler service, which is the top-level GnomeUIHandler, and
which creates the new menu item widgets and inserts them in the
appropriate places.  When the menu item is activated (i.e. the user
selects it), the notification propagates downwards in the
GnomeUIHandler tree.

	So the idea is that everyone can use the GnomeUIHandler
interface to manipulate their menus and toolbars.  And so I want to
get it right.

	As far as I am concerned, there are two main issues which I
would like feedback on:

  1. Because components will need to manipulate menu items which
     they did not create (in order, for example, to add submenu items
     to them), there needs to be a standard way of referring to these
     items.  My idea is to use a path like "File/Quit"[2].  The path
     will be a delimited concatenation of the untranslated menu
     labels.

  2. I can't decide whether to ditch GnomeUIInfo or not.  Of course,
     "ditching" would not mean that I wouldn't provide compatibility
     routines; it's only a matter of whether or not I use GnomeUIInfo
     for the structure which represents a menu/toolbar item.  Please
     see the comments in my api definition for more information about
     this issue.

	So any feedback on the API I've defined would be appreciated.
The API is in GNOME CVS now, in bonobo/bonobo/gnome-ui-handler.h.

Thanks in advance,
Nat

[1] No, AbiWord doesn't support Bonobo yet.
[2] '/' is probably not a very good delimiter.  But something can be
    chosen.



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