summaryrefslogtreecommitdiff
path: root/examples/open-terminal.py
diff options
context:
space:
mode:
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,