Nemo.MenuProvider

Nemo.MenuProvider

Nemo.MenuProvider Reference

## Synopsis

          Nemo.MenuProvider

            get_file_items
            window
            files

            get_file_items_full
            provider
            window
            files

            get_background_items
            window
            folder

            get_background_items_full
            provider
            window
            folder

            Nemo.menu_provider_emit_items_updated_signal
            provider

## Description

If subclassed, Nemo will request a list of `Nemo.MenuItem` objects, which are then attached to various menus. Nemo expects at least one of the following methods to be defined (or their *_full variants): get_file_items or get_background_items.

The get_toolbar_items methods were removed in nemo-python 1.0 because they were removed from Nemo 3. Technically, you should still be able to call those methods with nemo-python 1.0 if you are running Nemo 2.x with annotations.

### Nemo.MenuProvider Example

    from gi.repository import Nemo, GObject

    class ColumnExtension(GObject.GObject, Nemo.MenuProvider):
        def __init__(self):
            pass

        def get_file_items(self, window, files):
            top_menuitem = Nemo.MenuItem(name='ExampleMenuProvider::Foo',
                                             label='Foo',
                                             tip='',
                                             icon='')

            submenu = Nemo.Menu()
            top_menuitem.set_submenu(submenu)

            sub_menuitem = Nemo.MenuItem(name='ExampleMenuProvider::Bar',
                                             label='Bar',
                                             tip='',
                                             icon='')
            submenu.append_item(sub_menuitem)

            return top_menuitem,

        def get_background_items(self, window, file):
            submenu = Nemo.Menu()
            submenu.append_item(Nemo.MenuItem(name='ExampleMenuProvider::Bar2',
                                             label='Bar2',
                                             tip='',
                                             icon=''))

            menuitem = Nemo.MenuItem(name='ExampleMenuProvider::Foo2',
                                             label='Foo2',
                                             tip='',
                                             icon='')
            menuitem.set_submenu(submenu)

            return menuitem,

### Signals

"items-updated"

- `callback`

## Passive Methods

### Nemo.MenuProvider.get_file_items

                get_file_items
                window
                files

`window` :

- the current `gtk.Window` instance

`menu` :

- a list of `Nemo.FileInfo` objects.

Returns :

- a list of `Nemo.MenuItem` objects

The `get_file_items`() method returns a list of `Nemo.MenuItem` objects.

### Nemo.MenuProvider.get_file_items_full

                get_file_items_full
                provider
                window
                files

`provider` :

- the current `Nemo.MenuProvider` instance

`window` :

- the current `gtk.Window` instance

`files` :

- a list of `Nemo.FileInfo` objects.

Returns :

- a list of `Nemo.MenuItem` objects

The `get_file_items_full`() method returns a list of `Nemo.MenuItem` objects.

This method was created in order to allow extension writers to call the Nemo.menu_provider_emit_items_updated_signal, which must be passed the current provider instance.

This method was introduced in nemo-python 0.7.0.

### Nemo.MenuProvider.get_background_items

                get_background_items
                window
                folder

`window` :

- the current `gtk.Window` instance

`folder` :

- the current folder, as a `Nemo.FileInfo` object.

Returns :

- a list of `Nemo.MenuItem` objects

The `get_background_items`() method returns a list of `Nemo.MenuItem` objects.

### Nemo.MenuProvider.get_background_items_full

                get_background_items_full
                provider
                window
                folder

`provider` :

- the current `Nemo.MenuProvider` instance

`window` :

- the current `gtk.Window` instance

`folder` :

- the current folder, as a `Nemo.FileInfo` object.

Returns :

- a list of `Nemo.MenuItem` objects

The `get_background_items_full`() method returns a list of `Nemo.MenuItem` objects.

This method was created in order to allow extension writers to call the Nemo.menu_provider_emit_items_updated_signal, which must be passed the current provider instance.

This method was introduced in nemo-python 0.7.0.

## Active Methods

### Nemo.menu_provider_emit_items_updated_signal

                menu_provider_emit_items_updated_signal
                provider

`provider` :

- the current `Nemo.MenuProvider` instance

Emits the "items-updated" signal.

This method was introduced in nemo-python 0.7.0.

## Signal Details

### The "items-updated" Nemo.MenuProvider Signal

Emits the "items-updated" signal.