Caja.MenuProvider — Caja.MenuProvider Reference
class Caja.MenuProvider: |
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,
def get_file_items(window, files)
| the current gtk.Window instance |
| 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.
def get_file_items_full(provider, window, files)
| the current Caja.MenuProvider instance |
| the current gtk.Window instance |
| 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.
def get_background_items(window, folder)
| the current gtk.Window instance |
| 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.
def get_background_items_full(provider, window, folder)
| the current Caja.MenuProvider instance |
| the current gtk.Window instance |
| 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.
def menu_provider_emit_items_updated_signal(provider)
| the current Caja.MenuProvider instance |
Emits the "items-updated" signal.