Caja.MenuProvider

Caja.MenuProvider — Caja.MenuProvider Reference

Synopsis

class Caja.MenuProvider:
    def get_file_items(window, files)
def get_file_items_full(provider, window, files)
def get_background_items(window, folder)
def get_background_items_full(provider, window, folder)
def Caja.menu_provider_emit_items_updated_signal(provider)

Description

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

Example 5. Caja.MenuProvider Example

from gi.repository import Caja, GObject

class ColumnExtension(GObject.GObject, Caja.MenuProvider):
    def __init__(self):
        pass
        
    def get_file_items(self, window, files):
        top_menuitem = Caja.MenuItem(name='ExampleMenuProvider::Foo', 
                                         label='Foo', 
                                         tip='',
                                         icon='')

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

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

        return top_menuitem,

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

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

        return menuitem,

    

Signals

"items-updated"

def callback()

Passive Methods

Caja.MenuProvider.get_file_items

    def get_file_items(window, files)

window :

the current gtk.Window instance

menu :

a list of Caja.FileInfo objects.

Returns :

a list of Caja.MenuItem objects

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

Caja.MenuProvider.get_file_items_full

    def get_file_items_full(provider, window, files)

provider :

the current Caja.MenuProvider instance

window :

the current gtk.Window instance

files :

a list of Caja.FileInfo objects.

Returns :

a list of Caja.MenuItem objects

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

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

Note

This method was introduced in caja-python 0.7.0.

Caja.MenuProvider.get_background_items

    def get_background_items(window, folder)

window :

the current gtk.Window instance

folder :

the current folder, as a Caja.FileInfo object.

Returns :

a list of Caja.MenuItem objects

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

Caja.MenuProvider.get_background_items_full

    def get_background_items_full(provider, window, folder)

provider :

the current Caja.MenuProvider instance

window :

the current gtk.Window instance

folder :

the current folder, as a Caja.FileInfo object.

Returns :

a list of Caja.MenuItem objects

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

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

Note

This method was introduced in caja-python 0.7.0.

Active Methods

Caja.menu_provider_emit_items_updated_signal

    def menu_provider_emit_items_updated_signal(provider)

provider :

the current Caja.MenuProvider instance

Emits the "items-updated" signal.

Note

This method was introduced in caja-python 0.7.0.

Signal Details

The "items-updated" Caja.MenuProvider Signal

Emits the "items-updated" signal.