summaryrefslogtreecommitdiff
path: root/examples/submenu.py
diff options
context:
space:
mode:
authorYaakov Selkowitz <[email protected]>2012-12-20 00:41:24 -0600
committerStefano Karapetsas <[email protected]>2013-01-22 14:10:00 +0100
commit825c1dd01981c159368a1a7a99931146fbbe60f1 (patch)
tree13a781b2b2023d06a1d8fb52d600e71ff40f911a /examples/submenu.py
parent29149f504a4e5e28a19b92d9ebb831bb53100a01 (diff)
downloadpython-caja-825c1dd01981c159368a1a7a99931146fbbe60f1.tar.bz2
python-caja-825c1dd01981c159368a1a7a99931146fbbe60f1.tar.xz
Port examples to g-i and gsettings
Diffstat (limited to 'examples/submenu.py')
-rw-r--r--examples/submenu.py33
1 files changed, 21 insertions, 12 deletions
diff --git a/examples/submenu.py b/examples/submenu.py
index 7b91459..9d149f5 100644
--- a/examples/submenu.py
+++ b/examples/submenu.py
@@ -1,28 +1,37 @@
-import caja
+from gi.repository import Caja, GObject
-class ExampleMenuProvider(caja.MenuProvider):
-
- # Caja crashes if a plugin doesn't implement the __init__ method.
- # See Bug #374958
+class ExampleMenuProvider(GObject.GObject, Caja.MenuProvider):
def __init__(self):
pass
def get_file_items(self, window, files):
- top_menuitem = caja.MenuItem('ExampleMenuProvider::Foo', 'Foo', '')
+ top_menuitem = Caja.MenuItem(name='ExampleMenuProvider::Foo',
+ label='Foo',
+ tip='',
+ icon='')
- submenu = caja.Menu()
+ submenu = Caja.Menu()
top_menuitem.set_submenu(submenu)
- sub_menuitem = caja.MenuItem('ExampleMenuProvider::Bar', 'Bar', '')
+ 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('ExampleMenuProvider::Bar', 'Bar', ''))
-
- menuitem = caja.MenuItem('ExampleMenuProvider::Foo', 'Foo', '')
+ 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,