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
This commit is contained in:
Emmanuel Bretelle 2008-05-25 12:37:33 +01:00
parent ba469bb535
commit ca12af5125
2 changed files with 18 additions and 10 deletions

View File

@ -1124,9 +1124,14 @@ class Terminator:
def newtab(self,widget): def newtab(self,widget):
terminal = TerminatorTerm (self, self.profile, None, widget.get_cwd()) terminal = TerminatorTerm (self, self.profile, None, widget.get_cwd())
parent = widget.get_parent () 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): if isinstance(parent, gtk.Paned) or (isinstance(parent, gtk.Window) and (self.conf.extreme_tabs or not isinstance(child, gtk.Notebook))):
#no notebook yet. #no notebook yet.
notebook = gtk.Notebook() notebook = gtk.Notebook()
notebook.set_tab_pos(gtk.POS_TOP) notebook.set_tab_pos(gtk.POS_TOP)
@ -1135,24 +1140,26 @@ class Terminator:
notebook.set_tab_reorderable(widget, True) notebook.set_tab_reorderable(widget, True)
if isinstance(parent, gtk.Paned): if isinstance(parent, gtk.Paned):
if parent.get_child1() == widget: if parent.get_child1() == child:
widget.reparent(notebook) child.reparent(notebook)
parent.pack1(notebook) parent.pack1(notebook)
else: else:
widget.reparent(notebook) child.reparent(notebook)
parent.pack2(notebook) parent.pack2(notebook)
elif isinstance(parent, gtk.Window): elif isinstance(parent, gtk.Window):
widget.reparent(notebook) child.reparent(notebook)
parent.add(notebook) parent.add(notebook)
notebook.set_tab_reorderable(widget,True) notebook.set_tab_reorderable(child,True)
notebooklabel = "" notebooklabel = ""
if widget._vte.get_window_title() is not None: if widget._vte.get_window_title() is not None:
notebooklabel = widget._vte.get_window_title() notebooklabel = widget._vte.get_window_title()
notebook.set_tab_label_text(widget, notebooklabel) notebook.set_tab_label_text(child, notebooklabel)
notebook. set_tab_label_packing(widget, True, True, gtk.PACK_START) notebook. set_tab_label_packing(child, True, True, gtk.PACK_START)
notebook.show() notebook.show()
elif isinstance(parent, gtk.Notebook): elif isinstance(parent, gtk.Notebook):
notebook = parent notebook = parent
elif isinstance(parent, gtk.Window) and isinstance(child, gtk.Notebook):
notebook = child
else: else:
return (False) return (False)

View File

@ -114,6 +114,7 @@ class TerminatorConfValuestore:
'encoding' : 'UTF-8', 'encoding' : 'UTF-8',
'active_encodings' : ['UTF-8', 'ISO-8859-1'], 'active_encodings' : ['UTF-8', 'ISO-8859-1'],
'background_image' : '', 'background_image' : '',
'extreme_tabs' : False,
} }
def __getattr__ (self, keyname): def __getattr__ (self, keyname):