From ca12af51255dabec37ed1ece57149dc862842661 Mon Sep 17 00:00:00 2001 From: Emmanuel Bretelle Date: Sun, 25 May 2008 12:37:33 +0100 Subject: [PATCH] adding configuration extreme_tabs defaulting to False * If extreme_tabs is set to false, only the top level widget will go into tabs * if set to True, tabs will be created at any level * Fixes LP#234685 --- terminator | 27 +++++++++++++++++---------- terminatorlib/config.py | 1 + 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/terminator b/terminator index 72d76b3d..bd4b4a69 100755 --- a/terminator +++ b/terminator @@ -1124,9 +1124,14 @@ class Terminator: def newtab(self,widget): terminal = TerminatorTerm (self, self.profile, None, widget.get_cwd()) - parent = widget.get_parent () - - if isinstance(parent, gtk.Paned) or isinstance(parent, gtk.Window): + if(self.conf.extreme_tabs): + parent = widget.get_parent () + child = widget + else: + child = self.window.get_children()[0] + parent = child.get_parent() + + if isinstance(parent, gtk.Paned) or (isinstance(parent, gtk.Window) and (self.conf.extreme_tabs or not isinstance(child, gtk.Notebook))): #no notebook yet. notebook = gtk.Notebook() notebook.set_tab_pos(gtk.POS_TOP) @@ -1135,24 +1140,26 @@ class Terminator: notebook.set_tab_reorderable(widget, True) if isinstance(parent, gtk.Paned): - if parent.get_child1() == widget: - widget.reparent(notebook) + if parent.get_child1() == child: + child.reparent(notebook) parent.pack1(notebook) else: - widget.reparent(notebook) + child.reparent(notebook) parent.pack2(notebook) elif isinstance(parent, gtk.Window): - widget.reparent(notebook) + child.reparent(notebook) parent.add(notebook) - notebook.set_tab_reorderable(widget,True) + notebook.set_tab_reorderable(child,True) notebooklabel = "" if widget._vte.get_window_title() is not None: notebooklabel = widget._vte.get_window_title() - notebook.set_tab_label_text(widget, notebooklabel) - notebook. set_tab_label_packing(widget, True, True, gtk.PACK_START) + notebook.set_tab_label_text(child, notebooklabel) + notebook. set_tab_label_packing(child, True, True, gtk.PACK_START) notebook.show() elif isinstance(parent, gtk.Notebook): notebook = parent + elif isinstance(parent, gtk.Window) and isinstance(child, gtk.Notebook): + notebook = child else: return (False) diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 751fef06..ecd85187 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -114,6 +114,7 @@ class TerminatorConfValuestore: 'encoding' : 'UTF-8', 'active_encodings' : ['UTF-8', 'ISO-8859-1'], 'background_image' : '', + 'extreme_tabs' : False, } def __getattr__ (self, keyname):