Jordan Stinson wrote:
> Hi,
> I was wondering how the top level menu for GIMP is created (The one 
> with these items: "File", "Edit", "Select", "View", "Image", etc. ). I 
> want to add a menu item to this menu and I'm kind of lost as to where 
> to start. If someone could tell me where to hunt around in the code 
> for this and give me an explanation of how it's done, that would be 
> great! Even better, is there some documentation online about this kind 
> of thing?

The GIMP menus are created using the GTK+ menu APIs, often with some 
thin wrapper on top. The actual instantiation of the menu is in the 
gimp_display_shell_new() function:

  shell->menubar =
    gtk_ui_manager_get_widget (GTK_UI_MANAGER (shell->menubar_manager),

Some keywords to look up: GtkUIManager, GtkAction. The menu structure is 
in menus/ Note that you will need to install the 
modified file before GIMP can find it.

To add a new menu item these are the rough steps:

1. Edit
2. Add a GimpAction in <menu>-actions.c, e.g. image-actions.c if you are 
going to add something under the Image menu. Then just follow the 
pattern from there.

As a general tip, you will learn a lot from studying the commit history. 
There have been several occasions where menu items have been added and 
modified for example, so just looking up a commit for this and studying 
the diff will tell you how to do it.

 / Martin
Gimp-developer mailing list

Reply via email to