NautilusMenu: Nautilus Extension Reference Manual

## NautilusMenu NautilusMenu — Menu descriptor object |

## Functions

NautilusMenu * | nautilus_menu_new ()
void | nautilus_menu_append_item ()
GList * | nautilus_menu_get_items ()
void | nautilus_menu_item_list_free ()
NautilusMenuItem * | nautilus_menu_item_new ()
void | nautilus_menu_item_activate ()
void | nautilus_menu_item_set_submenu ()

## Properties

char * | icon | Read / Write
char * | label | Read / Write
NautilusMenu * | menu | Read / Write
char * | name | Read / Write / Construct Only
gboolean | priority | Read / Write
gboolean | sensitive | Read / Write
char * | tip | Read / Write

## Signals

void | activate | Run Last

## Types and Values

| NautilusMenu
| NautilusMenuItem

## Object Hierarchy

        GObject
        ├── NautilusMenu
        ╰── NautilusMenuItem

## Includes

    #include <nautilus-extension.h>

## Description

NautilusMenu is an object that describes a submenu in a file manager menu. Extensions can provide NautilusMenu objects by attaching them to NautilusMenuItem objects, using `nautilus_menu_item_set_submenu()`.

#### Menu Items

NautilusMenuItem is an object that describes an item in a file manager menu. Extensions can provide NautilusMenuItem objects by registering a NautilusMenuProvider and returning them from `nautilus_menu_provider_get_file_items()`, or `nautilus_menu_provider_get_background_items()`, which will be called by the main application when creating menus.

## Functions

### nautilus_menu_new ()

    NautilusMenu *
    nautilus_menu_new (void);

#### Returns

a new NautilusMenu.

### nautilus_menu_append_item ()

    void
    nautilus_menu_append_item (NautilusMenu *menu,
                               NautilusMenuItem *item);

#### Parameters

menu | a NautilusMenu |
item | a NautilusMenuItem to append. | [transfer full]

### nautilus_menu_get_items ()

    GList *
    nautilus_menu_get_items (NautilusMenu *menu);

#### Parameters

menu | a NautilusMenu |

#### Returns

the provided NautilusMenuItem list.

[element-type NautilusMenuItem][transfer full]

### nautilus_menu_item_list_free ()

    void
    nautilus_menu_item_list_free (GList *item_list);

#### Parameters

item_list | a list of NautilusMenuItem. | [element-type NautilusMenuItem]

### nautilus_menu_item_new ()

    NautilusMenuItem *
    nautilus_menu_item_new (const char *name,
                            const char *label,
                            const char *tip,
                            const char *icon);

Creates a new menu item that can be added to the toolbar or to a contextual menu.

#### Parameters

name | the identifier for the menu item |
label | the user-visible label of the menu item |
tip | the tooltip of the menu item |
icon | the name of the icon to display in the menu item |

#### Returns

a new NautilusMenuItem.

[transfer full]

### nautilus_menu_item_activate ()

    void
    nautilus_menu_item_activate (NautilusMenuItem *item);

Emits “activate”.

#### Parameters

item | pointer to a NautilusMenuItem |

### nautilus_menu_item_set_submenu ()

    void
    nautilus_menu_item_set_submenu (NautilusMenuItem *item,
                                    NautilusMenu *menu);

Attaches a menu to the given NautilusMenuItem.

#### Parameters

item | pointer to a NautilusMenuItem |
menu | pointer to a NautilusMenu to attach to the button. | [transfer full]

## Types and Values

### NautilusMenu

    typedef struct _NautilusMenu NautilusMenu;

### NautilusMenuItem

    typedef struct _NautilusMenuItem NautilusMenuItem;

## Property Details

### The `“icon”` property

      “icon”                     char *

Name of the icon to display in the menu item.

Owner: NautilusMenuItem

Flags: Read / Write

Default value: NULL

### The `“label”` property

      “label”                    char *

Label to display to the user.

Owner: NautilusMenuItem

Flags: Read / Write

Default value: NULL

### The `“menu”` property

      “menu”                     NautilusMenu *

The menu belonging to this item. May be null.

Owner: NautilusMenuItem

Flags: Read / Write

### The `“name”` property

      “name”                     char *

Name of the item.

Owner: NautilusMenuItem

Flags: Read / Write / Construct Only

Default value: NULL

### The `“priority”` property

      “priority”                 gboolean

Show priority text in toolbars.

Owner: NautilusMenuItem

Flags: Read / Write

Default value: TRUE

### The `“sensitive”` property

      “sensitive”                gboolean

Whether the menu item is sensitive.

Owner: NautilusMenuItem

Flags: Read / Write

Default value: TRUE

### The `“tip”` property

      “tip”                      char *

Tooltip for the menu item.

Owner: NautilusMenuItem

Flags: Read / Write

Default value: NULL

## Signal Details

### The `“activate”` signal

    void
    user_function (NautilusMenuItem *item,
                   gpointer          user_data)

Signals that the user has activated this menu item.

#### Parameters

item | the object which received the signal |
user_data | user data set when the signal handler was connected. |

Flags: Run Last