← Back to team overview

unity-dev team mailing list archive

Re: menu bar understanding

 

Il 08/30/2012 11:12 AM, Francesco M. ha scritto:
Hello,

I'm trying to understand how the menu bar works. I would like to understand how menus are "taken" from applications and rendered in Unity.

We have bridges such as appmenu-gtk and appmenu-qt that exposes the menus of the applications as dbus menus trough libdbusmenu, then indicator-appmenu loads them and we expose the menu entries to unity via unity-panel-service to unity itself (again via DBus). In unity we have some libunity-core classes (see DBusIndicators, Indicators, Indicator, indicator::Entry) that allow to translate these dbus data to the panel menu entries.

So, in unityshell itself we fetch these dbus menus entries through DBusIndicators (in PanelView) and we add the entries to a PanelMenuView or to a PanelIndicatorsView instance (depending if these refers to menus or to indicators). PanelIndicatorEntryView will take care of rendering all them.

When you click over a menu/indicator in the panel, we make a dbus call to unity-panel-service (trough the indicator::Entry proxy), at that point the panel service will ask to the related indicator-object (i.e. to the owner of the entry) to activate the clicked indicator/menu entry and to show the menu at the given position.

In PanelMenuView's constructor there is a reference to a variable named "layout_". Where is that variable defined? In the header file there is a (unused?) "_menu_layout".

layout_ is defined in PanelIndicatorsView (that PanelMenuView extends), _menu_layout is no more used and can be deleted.

The first line of the constructor says to render menu items aligned from the left to the right. Where is the layout definition?

See above.


And could someone tell me where happens the population of this layout with menu items?

I hope I explained this at the beginning.


References