Fix splitting from the context menu so it sends the cwd

This commit is contained in:
Chris Jones 2010-03-11 14:30:07 +00:00
parent 2164f32ddb
commit b4d259f053
1 changed files with 7 additions and 2 deletions

View File

@ -9,6 +9,7 @@ import gtk
from version import APP_NAME from version import APP_NAME
from translation import _ from translation import _
from encoding import TerminatorEncoding from encoding import TerminatorEncoding
from terminator import Terminator
from util import err from util import err
from config import Config from config import Config
from prefseditor import PrefsEditor from prefseditor import PrefsEditor
@ -17,10 +18,12 @@ import plugin
class TerminalPopupMenu(object): class TerminalPopupMenu(object):
"""Class implementing the Terminal context menu""" """Class implementing the Terminal context menu"""
terminal = None terminal = None
terminator = None
def __init__(self, terminal): def __init__(self, terminal):
"""Class initialiser""" """Class initialiser"""
self.terminal = terminal self.terminal = terminal
self.terminator = Terminator()
def show(self, widget, event=None): def show(self, widget, event=None):
"""Display the context menu""" """Display the context menu"""
@ -82,7 +85,8 @@ class TerminalPopupMenu(object):
item.set_image(image) item.set_image(image)
if hasattr(item, 'set_always_show_image'): if hasattr(item, 'set_always_show_image'):
item.set_always_show_image(True) item.set_always_show_image(True)
item.connect('activate', lambda x: terminal.emit('split-horiz')) item.connect('activate', lambda x: terminal.emit('split-horiz',
self.terminator.pid_cwd(self.terminal.pid)))
menu.append(item) menu.append(item)
item = gtk.ImageMenuItem('Split V_ertically') item = gtk.ImageMenuItem('Split V_ertically')
@ -91,7 +95,8 @@ class TerminalPopupMenu(object):
item.set_image(image) item.set_image(image)
if hasattr(item, 'set_always_show_image'): if hasattr(item, 'set_always_show_image'):
item.set_always_show_image(True) item.set_always_show_image(True)
item.connect('activate', lambda x: terminal.emit('split-vert')) item.connect('activate', lambda x: terminal.emit('split-vert',
self.terminator.pid_cwd(self.terminal.pid)))
menu.append(item) menu.append(item)
item = gtk.MenuItem(_('Open _Tab')) item = gtk.MenuItem(_('Open _Tab'))