refactor tab creation signals to propagate to the Window of a Terminal, not Terminator

This commit is contained in:
Chris Jones 2010-01-28 12:49:38 +00:00
parent b3435e534f
commit 0817d2651d
4 changed files with 9 additions and 11 deletions

View File

@ -116,7 +116,8 @@ class Notebook(Container, gtk.Notebook):
'ungroup-all': top_window.ungroup_all, 'ungroup-all': top_window.ungroup_all,
'group-tab': top_window.group_tab, 'group-tab': top_window.group_tab,
'ungroup-tab': top_window.ungroup_tab, 'ungroup-tab': top_window.ungroup_tab,
'move-tab': top_window.move_tab} 'move-tab': top_window.move_tab,
'tab-new': top_window.tab_new}
if maker.isinstance(widget, 'Terminal'): if maker.isinstance(widget, 'Terminal'):
for signal in signals: for signal in signals:

View File

@ -91,7 +91,8 @@ class Paned(Container):
'group-tab': top_window.group_tab, 'group-tab': top_window.group_tab,
'ungroup-tab': top_window.ungroup_tab, 'ungroup-tab': top_window.ungroup_tab,
'move-tab': top_window.move_tab, 'move-tab': top_window.move_tab,
'maximise': [top_window.zoom, False]} 'maximise': [top_window.zoom, False],
'tab-new': top_window.tab_new}
for signal in signals: for signal in signals:
args = [] args = []

View File

@ -71,7 +71,6 @@ class Terminator(Borg):
self.terminals.append(terminal) self.terminals.append(terminal)
terminal.connect('ungroup-all', self.ungroup_all) terminal.connect('ungroup-all', self.ungroup_all)
terminal.connect('navigate', self.navigate_terminal) terminal.connect('navigate', self.navigate_terminal)
terminal.connect('tab-new', self.tab_new)
def deregister_terminal(self, terminal): def deregister_terminal(self, terminal):
"""De-register a terminal widget""" """De-register a terminal widget"""
@ -100,12 +99,6 @@ class Terminator(Borg):
for terminal in self.terminals: for terminal in self.terminals:
terminal.reconfigure() terminal.reconfigure()
def tab_new(self, terminal):
"""A terminal asked for a new tab. This function is an indirection
to the Window object"""
window = get_top_window(terminal)
window.tab_new()
def navigate_terminal(self, terminal, direction): def navigate_terminal(self, terminal, direction):
"""Nagivate around the terminals""" """Nagivate around the terminals"""
current = self.terminals.index(terminal) current = self.terminals.index(terminal)
@ -250,10 +243,12 @@ class Terminator(Borg):
def group_tab(self, widget): def group_tab(self, widget):
"""Group all the terminals in a tab""" """Group all the terminals in a tab"""
# FIXME: Implement or drop
pass pass
def ungroup_tab(self, widget): def ungroup_tab(self, widget):
"""Ungroup all the terminals in a tab""" """Ungroup all the terminals in a tab"""
# FIXME: Implement or drop
pass pass
def focus_changed(self, widget): def focus_changed(self, widget):

View File

@ -157,7 +157,7 @@ class Window(Container, gtk.Window):
maker = Factory() maker = Factory()
return(maker.isinstance(self.get_child(), 'Notebook')) return(maker.isinstance(self.get_child(), 'Notebook'))
def tab_new(self): def tab_new(self, widget=None):
"""Make a new tab""" """Make a new tab"""
maker = Factory() maker = Factory()
if not self.is_child_notebook(): if not self.is_child_notebook():
@ -260,7 +260,8 @@ class Window(Container, gtk.Window):
'ungroup-all': self.ungroup_all, 'ungroup-all': self.ungroup_all,
'group-tab': self.group_tab, 'group-tab': self.group_tab,
'ungroup-tab': self.ungroup_tab, 'ungroup-tab': self.ungroup_tab,
'move-tab': self.move_tab} 'move-tab': self.move_tab,
'tab-new': self.tab_new}
for signal in signals: for signal in signals:
self.connect_child(widget, signal, signals[signal]) self.connect_child(widget, signal, signals[signal])