provide menus that can be read from an xml file
provide menus that can be intersected with each other
Many details are omitted in the diagram in order to concentrate on the concept here.
The Context_Menu_Factory makes the Top_Menus build themselves by reading the XML file. Top_Menus represent the highest level of the menus. I.e. one only has to deal with Top_Menus when using context menus. They can be fetched from the Context_Menu_Factory when knowing the name of the desired menu.
Two menus can be intersected so that only the Menu_Items remain that both have in common.
The Menu_Items can decide whether they are greyed out or not by asking their corresponding Command_Factory if the Command is executable with the given Data_Source.
The Con_Men_Handler contains a GTK Callback Handler that can deal with a clicked Menu_Item. It calls the corresponding Command_Factory and gives it the set of Display-Objects and a Data_Source.
A Top_Menu can be displayed by getting the corresponding GTK_Menu from the Top_Menu. The GTK_Menu then has to be send the show and the popup message.
The Con_Men_Controller implements a Show method that can deal with a set of Display_Objects and a Parameter_Pot. It interesects the Top_Menus of the given Display_Objects and shows it.