2.  Main menus

The main menu hook lets you hook into various main menus in Evolution, based on the current active view (component). The system works by piggy-backing on the existing use of the BonoboUI menu system used by all of the Evolution components. Bonobo handles the menu merging and user input, and the hook resolves the verb being invoked and redirects it to the plugin. Each view defines a single target which describes the appropriate context. For the Mail view, this is the current folder and currently selected message(s).

Each view keeps track of its own manager object. When it is (de)activated, it also (de)activates the management object which dynamically adds and removes the menu items from the BonoboUIContainer via a supplied BonoboUI XML definition file <perhaps it should embed the bonobouixml>. If the target changes, the view lets the manager know, and it updates the visibility and sensitivity of objects appropriately, allowing reasonably dynamic user-interfaces to be managed automatically. The plugin itself isn't loaded until the menu item in question is invoked

Simple menu items and toggle menu items are supported currently. Also, because actual menu display is driven by BonoboUI, then toolbar items can also be added using this mechanism.

2.1. Defining a menu hook

Not sure if this fits here as such. Probably temporary placeholder.

	    
<hook class="com.ximian.evolution.mail.bonoboMenu:1.0">
 <menu id="menuid" target="targettype"
  <ui file="/path/to/bonobo-ui-menu-definition.xml"> +
  <item
   type="item | toggle | radio"
   active ?
   path="/commands/FooBar"
   verb="FooBar"
   visible="target mask" ?
   enable="target mask" ?
   activate="function spec"/> *
 </menu> *
</hook>

Need to define menu tag

ui
The ui element contains a filename of the BonoboUI XML menu definition to load when the view is activated. Any number of ui elements may be defined, and they are all loaded.
type
The menu item type. The type maps directly to the corresponding EMenuItem types. radio is currently not implemented.
active
If present, then radio or toggle menu items are active when first shown. After the first instantiation, they will remember their active state.
path
The BonoboUI element path corresponding to this menu item.
verb
The BonoboUI verb corresponding to the item to be listened to.
visible
A comma separated list of mask enumeration values used to define when this item is shown. What values are valid depend on the menu hook class of the menu being hooked onto.
enable
A comma separated list of mask enumeration values used to define when this item is sensitive. What values are valid depend on the menu hook class of the menu being hooked onto.
activate
A plugin-type specific function specification. This function will be resolved and called when the menu item is activated. The funciton's parameters will depend on the type of menu item being invoked.

2.2. Merging Plugin Items

Merging is performed by BonoboUI, and the source of the menu data is defined by the ui file.