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() parent = self.get_parent()
title = widget.get_window_title() title = widget.get_window_title()
dbg('Container::propagate_title_change: I am %s. My parent is %s' %
(self, parent))
if maker.isinstance(self, 'Notebook'): if maker.isinstance(self, 'Notebook'):
self.update_tab_label_text(widget, title) self.update_tab_label_text(widget, title)
elif maker.isinstance(self, 'Window'): elif maker.isinstance(self, 'Window'):

View File

@ -226,12 +226,25 @@ class Notebook(Container, gtk.Notebook):
"""Unzoom a terminal""" """Unzoom a terminal"""
raise NotImplementedError('unzoom') 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): def update_tab_label_text(self, widget, text):
"""Update the text of a tab label""" """Update the text of a tab label"""
# FIXME: get_tab_label() doesn't descend the widget tree. We need notebook = self.find_tab_root(widget)
# something that does or this only works for Notebook->Terminal, not label = self.get_tab_label(notebook)
# Notebook->Container->...->Terminal
label = self.get_tab_label(widget)
if not label: if not label:
err('Notebook::update_tab_label_text: %s not found' % widget) err('Notebook::update_tab_label_text: %s not found' % widget)
return return