Now that we've shown you the hard way, here's how you do it using the gtk_item_factory calls.
ItemFactory creates a menu out of an array of ItemFactory entries. This means you can define your menu in its simplest form and then create the menu/menubar widgets with a minimum of function calls.
At the core of ItemFactory is the ItemFactoryEntry. This structure defines one menu item, and when an array of these entries is defined a whole menu is formed. The ItemFactory entry struct definition looks like this:
The callback for an ItemFactory entry can take two forms. If callback_action is zero, it is of the following form:
An array of GtkItemFactoryEntry items defines a menu. Once this array is defined then the item factory can be created. The function that does this is:
The last thing to do is make use of the menu. The following function extracts the relevant widgets from the ItemFactory:
Now you have a menubar or menu which can be manipulated in the same way as shown in the Manual Menu Creation section.