Make title propagation work properly

This commit is contained in:
Chris Jones 2009-12-10 23:25:52 +00:00
parent 602c6a3b57
commit 7d897eaef7
2 changed files with 17 additions and 6 deletions

View File

@ -179,8 +179,6 @@ the %s will also close all terminals within it.') % (reqtype, reqtype))
parent = self.get_parent()
title = widget.get_window_title()
dbg('Container::propagate_title_change: I am %s. My parent is %s' %
(self, parent))
if maker.isinstance(self, 'Notebook'):
self.update_tab_label_text(widget, title)
elif maker.isinstance(self, 'Window'):

View File

@ -226,12 +226,25 @@ class Notebook(Container, gtk.Notebook):
"""Unzoom a terminal"""
raise NotImplementedError('unzoom')
def find_tab_root(self, widget):
"""Look for the tab child which is or ultimately contains the supplied
widget"""
parent = widget.get_parent()
previous = parent
while parent is not None and parent is not self:
previous = parent
parent = parent.get_parent()
if previous == self:
return(widget)
else:
return(previous)
def update_tab_label_text(self, widget, text):
"""Update the text of a tab label"""
# FIXME: get_tab_label() doesn't descend the widget tree. We need
# something that does or this only works for Notebook->Terminal, not
# Notebook->Container->...->Terminal
label = self.get_tab_label(widget)
notebook = self.find_tab_root(widget)
label = self.get_tab_label(notebook)
if not label:
err('Notebook::update_tab_label_text: %s not found' % widget)
return