Use TerminatorTerm's get_window_title(), rather than everyone asking vte and failing to handle it properly.

This commit is contained in:
Thomas Hurst 2008-08-07 23:07:21 +01:00
parent 4c0e500c7b
commit f96018f0bc
2 changed files with 9 additions and 13 deletions

View File

@ -329,7 +329,7 @@ class Terminator:
#parent.remove_page(page) #parent.remove_page(page)
pane.show() pane.show()
parent.insert_page(pane, None, page) parent.insert_page(pane, None, page)
notebooktablabel = TerminatorNotebookTabLabel(widget._vte.get_window_title(), parent, self) notebooktablabel = TerminatorNotebookTabLabel(widget.get_window_title(), parent, self)
parent.set_tab_label(pane,notebooktablabel) parent.set_tab_label(pane,notebooktablabel)
parent.set_tab_label_packing(pane, True, True, gtk.PACK_START) parent.set_tab_label_packing(pane, True, True, gtk.PACK_START)
parent.set_tab_reorderable(pane, True) parent.set_tab_reorderable(pane, True)
@ -489,8 +489,8 @@ class Terminator:
notebooklabel = "" notebooklabel = ""
if isinstance(child, TerminatorTerm): if isinstance(child, TerminatorTerm):
child._titlebox.hide() child._titlebox.hide()
if widget._vte.get_window_title() is not None: if widget.get_window_title() is not None:
notebooklabel = widget._vte.get_window_title() notebooklabel = widget.get_window_title()
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)
@ -515,13 +515,7 @@ class Terminator:
notebook.append_page(terminal,None) notebook.append_page(terminal,None)
terminal.show () terminal.show ()
terminal.spawn_child () terminal.spawn_child ()
## Some gtk/vte weirdness notebooklabel = terminal.get_window_title()
## If we don't use this silly test,
## terminal._vte.get_window_title() might return
## bogus values
notebooklabel = ""
if terminal._vte.get_window_title() is not None:
notebooklabel = terminal._vte.get_window_title()
notebooktablabel = TerminatorNotebookTabLabel(notebooklabel, notebook, self) notebooktablabel = TerminatorNotebookTabLabel(notebooklabel, notebook, self)
notebook.set_tab_label(terminal, notebooktablabel) notebook.set_tab_label(terminal, notebooktablabel)
notebook.set_tab_label_packing(terminal, True, True, gtk.PACK_START) notebook.set_tab_label_packing(terminal, True, True, gtk.PACK_START)

View File

@ -968,14 +968,16 @@ text/plain
radioitem.connect ('activate', self.on_encoding_change, encoding[1]) radioitem.connect ('activate', self.on_encoding_change, encoding[1])
submenu.append (radioitem) submenu.append (radioitem)
def get_vte_window_title(self, vte): def get_window_title(self, vte = None):
if vte is None:
vte = self._vte
title = vte.get_window_title () title = vte.get_window_title ()
if title is None: if title is None:
title = str(self.command) title = str(self.command)
return title return title
def on_vte_title_change(self, vte): def on_vte_title_change(self, vte):
title = self.get_vte_window_title(vte) title = self.get_window_title(vte)
if self.conf.titletips: if self.conf.titletips:
vte.set_property ("has-tooltip", True) vte.set_property ("has-tooltip", True)
vte.set_property ("tooltip-text", title) vte.set_property ("tooltip-text", title)
@ -1001,7 +1003,7 @@ text/plain
return return
def on_vte_focus(self, vte): def on_vte_focus(self, vte):
title = self.get_vte_window_title(vte) title = self.get_window_title(vte)
self.terminator.set_window_title("%s - %s" % (title, APP_NAME.capitalize())) self.terminator.set_window_title("%s - %s" % (title, APP_NAME.capitalize()))
notebookpage = self.terminator.get_first_notebook_page(vte) notebookpage = self.terminator.get_first_notebook_page(vte)
while notebookpage != None: while notebookpage != None: