diff --git a/terminatorlib/newterminator.py b/terminatorlib/newterminator.py index 167afc37..0fa427cc 100755 --- a/terminatorlib/newterminator.py +++ b/terminatorlib/newterminator.py @@ -6,7 +6,7 @@ from borg import Borg from config import Config from keybindings import Keybindings -from util import dbg +from util import dbg, get_top_window class Terminator(Borg): """master object for the application""" @@ -62,6 +62,7 @@ class Terminator(Borg): self.terminals.append(terminal) terminal.connect('ungroup-all', self.ungroup_all) terminal.connect('navigate', self.navigate_terminal) + terminal.connect('tab-new', self.tab_new) def deregister_terminal(self, terminal): """De-register a terminal widget""" @@ -81,6 +82,12 @@ class Terminator(Borg): for terminal in self.terminals: 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): """Nagivate around the terminals""" current = self.terminals.index(terminal) diff --git a/terminatorlib/notebook.py b/terminatorlib/notebook.py index a7d8e662..28197e82 100755 --- a/terminatorlib/notebook.py +++ b/terminatorlib/notebook.py @@ -162,8 +162,12 @@ class Notebook(Container, gtk.Notebook): if maker.isinstance(child, 'Terminal'): child.close() elif maker.isinstance(child, 'Container'): - #FIXME: Handle this case - dbg('Notebook::closetab: Container children not yet handled') + dialog = self.construct_confirm_close(self.get_window(), _('tab')) + result = dialog.run() + dialog.destroy() + + if result is True: + print child.get_children() else: err('Notebook::closetab: Unknown child type %s' % child) diff --git a/terminatorlib/window.py b/terminatorlib/window.py index 8ac54936..47b237fb 100755 --- a/terminatorlib/window.py +++ b/terminatorlib/window.py @@ -116,13 +116,18 @@ class Window(Container, gtk.Window): self.on_destroy_event(window, gtk.gdk.Event(gtk.gdk.DESTROY)) elif mapping == 'new_tab': - if not maker.isinstance(self.get_child(), 'Notebook'): - notebook = maker.make('Notebook', self) - self.get_child().newtab() + self.tab_new() else: return(False) return(True) + def tab_new(self): + """Make a new tab""" + maker = Factory() + if not maker.isinstance(self.get_child(), 'Notebook'): + notebook = maker.make('Notebook', self) + self.get_child().newtab() + def on_delete_event(self, window, event, data=None): """Handle a window close request""" maker = Factory()