Nautilus.MenuProvider Nautilus.MenuProvider Reference

## Synopsis

Nautilus.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 Nautilus.menu_provider_emit_items_updated_signal provider

## Description

If subclassed, Nautilus will request a list of Nautilus.MenuItem objects, which are then attached to various menus. Nautilus 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 nautilus-python 1.0 because they were removed from Nautilus 3. Technically, you should still be able to call those methods with nautilus-python 1.0 if you are running Nautilus 2.x with annotations.

Nautilus.MenuProvider Example

    from gi.repository import Nautilus, GObject

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

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

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

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

            return top_menuitem,

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

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

            return menuitem,

### Signals

"items-updated"
  callback

## Passive Methods

### Nautilus.MenuProvider.get_file_items

                get_file_items
                window
                files

window :

  the current gtk.Window instance

menu :

  a list of Nautilus.FileInfo objects.

Returns :

  a list of Nautilus.MenuItem objects

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

### Nautilus.MenuProvider.get_file_items_full

                get_file_items_full
                provider
                window
                files

provider :

  the current Nautilus.MenuProvider instance

window :

  the current gtk.Window instance

files :

  a list of Nautilus.FileInfo objects.

Returns :

  a list of Nautilus.MenuItem objects

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

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

This method was introduced in nautilus-python 0.7.0.

### Nautilus.MenuProvider.get_background_items

                get_background_items
                window
                folder

window :

  the current gtk.Window instance

folder :

  the current folder, as a Nautilus.FileInfo object.

Returns :

  a list of Nautilus.MenuItem objects

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

### Nautilus.MenuProvider.get_background_items_full

                get_background_items_full
                provider
                window
                folder

provider :

  the current Nautilus.MenuProvider instance

window :

  the current gtk.Window instance

folder :

  the current folder, as a Nautilus.FileInfo object.

Returns :

  a list of Nautilus.MenuItem objects

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

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

This method was introduced in nautilus-python 0.7.0.

## Active Methods

### Nautilus.menu_provider_emit_items_updated_signal

                menu_provider_emit_items_updated_signal
                provider

provider :

  the current Nautilus.MenuProvider instance

Emits the "items-updated" signal.

This method was introduced in nautilus-python 0.7.0.

## Signal Details

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

Emits the "items-updated" signal.