diff options
author | Stefano Karapetsas <[email protected]> | 2012-01-13 23:18:04 +0100 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2012-01-13 23:18:04 +0100 |
commit | ca0a8f4d6cc24707bc07c3013bff321e2f0c24fd (patch) | |
tree | 4c4d47f249603be3cb816b1456a9dc71c0b48999 /examples/submenu.py | |
download | python-caja-ca0a8f4d6cc24707bc07c3013bff321e2f0c24fd.tar.bz2 python-caja-ca0a8f4d6cc24707bc07c3013bff321e2f0c24fd.tar.xz |
initial import from Mate-Extra repo
Diffstat (limited to 'examples/submenu.py')
-rw-r--r-- | examples/submenu.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/examples/submenu.py b/examples/submenu.py new file mode 100644 index 0000000..7b91459 --- /dev/null +++ b/examples/submenu.py @@ -0,0 +1,29 @@ +import caja + +class ExampleMenuProvider(caja.MenuProvider): + + # Caja crashes if a plugin doesn't implement the __init__ method. + # See Bug #374958 + def __init__(self): + pass + + def get_file_items(self, window, files): + top_menuitem = caja.MenuItem('ExampleMenuProvider::Foo', 'Foo', '') + + submenu = caja.Menu() + top_menuitem.set_submenu(submenu) + + sub_menuitem = caja.MenuItem('ExampleMenuProvider::Bar', 'Bar', '') + submenu.append_item(sub_menuitem) + + return top_menuitem, + + def get_background_items(self, window, file): + submenu = caja.Menu() + submenu.append_item(caja.MenuItem('ExampleMenuProvider::Bar', 'Bar', '')) + + menuitem = caja.MenuItem('ExampleMenuProvider::Foo', 'Foo', '') + menuitem.set_submenu(submenu) + + return menuitem, + |