Fixing LP#247457

resizing the window when creating or destroying the notebook
This commit is contained in:
Emmanuel Bretelle 2008-07-12 13:05:35 +01:00
parent ace185a76e
commit 512c8d5091
1 changed files with 12 additions and 1 deletions

View File

@ -79,6 +79,12 @@ class TerminatorNotebookTabLabel(gtk.HBox):
def get_title(self): def get_title(self):
return self._label.get_text() return self._label.get_text()
def height_request(self):
return self.size_request()[1]
def width_request(self):
return self.size_request()[0]
class Terminator: class Terminator:
def __init__ (self, profile = None, command = None, fullscreen = False, maximise = False, borderless = False): def __init__ (self, profile = None, command = None, fullscreen = False, maximise = False, borderless = False):
@ -488,7 +494,9 @@ class Terminator:
notebooktablabel = TerminatorNotebookTabLabel(notebooklabel, notebook, self) notebooktablabel = TerminatorNotebookTabLabel(notebooklabel, notebook, self)
notebook.set_tab_label(child, notebooktablabel) notebook.set_tab_label(child, notebooktablabel)
notebook.set_tab_label_packing(child, True, True, gtk.PACK_START) notebook.set_tab_label_packing(child, True, True, gtk.PACK_START)
notebook.show() # LP#247457 keep VTEs real estate
self.window.resize(self.window.allocation.width, min(self.window.allocation.height + notebooktablabel.height_request(), gtk.gdk.screen_height()))
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): elif isinstance(parent, gtk.Window) and isinstance(child, gtk.Notebook):
@ -606,6 +614,9 @@ class Terminator:
index = self.term_list.index (widget) index = self.term_list.index (widget)
self.term_list.remove (widget) self.term_list.remove (widget)
if nbpages == 1: if nbpages == 1:
# LP#247457 keep VTEs real estate
if self.window.allocation.height != gtk.gdk.screen_height():
self.window.resize(self.window.allocation.width, min(self.window.allocation.height - parent.get_tab_label(parent.get_nth_page(0)).height_request(), gtk.gdk.screen_height()))
sibling = parent.get_nth_page(0) sibling = parent.get_nth_page(0)
parent.remove(sibling) parent.remove(sibling)
gdparent = parent.get_parent() gdparent = parent.get_parent()