summaryrefslogtreecommitdiff
path: root/examples/open-terminal.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/open-terminal.py
parent29149f504a4e5e28a19b92d9ebb831bb53100a01 (diff)
downloadpython-caja-825c1dd01981c159368a1a7a99931146fbbe60f1.tar.bz2
python-caja-825c1dd01981c159368a1a7a99931146fbbe60f1.tar.xz
Port examples to g-i and gsettings
Diffstat (limited to 'examples/open-terminal.py')
-rw-r--r--examples/open-terminal.py25
1 files changed, 12 insertions, 13 deletions
diff --git a/examples/open-terminal.py b/examples/open-terminal.py
index 8e22ccf..1d0e5aa 100644
--- a/examples/open-terminal.py
+++ b/examples/open-terminal.py
@@ -2,19 +2,18 @@
import os
import urllib
-import gtk
-import caja
-import mateconf
+from gi.repository import Caja, GObject, Gio
-TERMINAL_KEY = '/desktop/mate/applications/terminal/exec'
+TERMINAL_SCHEMA = 'org.mate.applications-terminal'
+TERMINAL_KEY = 'exec'
-class OpenTerminalExtension(caja.MenuProvider):
+class OpenTerminalExtension(Caja.MenuProvider, GObject.GObject):
def __init__(self):
- self.client = mateconf.client_get_default()
+ self.gsettings = Gio.Settings.new(TERMINAL_SCHEMA)
def _open_terminal(self, file):
filename = urllib.unquote(file.get_uri()[7:])
- terminal = self.client.get_string(TERMINAL_KEY)
+ terminal = self.gsettings[TERMINAL_KEY]
os.chdir(filename)
os.system('%s &' % terminal)
@@ -33,15 +32,15 @@ class OpenTerminalExtension(caja.MenuProvider):
if not file.is_directory() or file.get_uri_scheme() != 'file':
return
- item = caja.MenuItem('CajaPython::openterminal_file_item',
- 'Open Terminal' ,
- 'Open Terminal In %s' % file.get_name())
+ item = Caja.MenuItem(name='CajaPython::openterminal_file_item',
+ label='Open Terminal' ,
+ tip='Open Terminal In %s' % file.get_name())
item.connect('activate', self.menu_activate_cb, file)
return item,
def get_background_items(self, window, file):
- item = caja.MenuItem('CajaPython::openterminal_item',
- 'Open Terminal Here',
- 'Open Terminal In This Directory')
+ item = Caja.MenuItem(name='CajaPython::openterminal_item',
+ label='Open Terminal Here',
+ tip='Open Terminal In This Directory')
item.connect('activate', self.menu_background_activate_cb, file)
return item,