From f96018f0bcf9f1de85252934206ec972a68fd025 Mon Sep 17 00:00:00 2001 From: Thomas Hurst Date: Thu, 7 Aug 2008 23:07:21 +0100 Subject: [PATCH] Use TerminatorTerm's get_window_title(), rather than everyone asking vte and failing to handle it properly. --- terminatorlib/terminator.py | 14 ++++---------- terminatorlib/terminatorterm.py | 8 +++++--- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index 389a2e0c..3670f4e3 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -329,7 +329,7 @@ class Terminator: #parent.remove_page(page) pane.show() 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_packing(pane, True, True, gtk.PACK_START) parent.set_tab_reorderable(pane, True) @@ -489,8 +489,8 @@ class Terminator: notebooklabel = "" if isinstance(child, TerminatorTerm): child._titlebox.hide() - if widget._vte.get_window_title() is not None: - notebooklabel = widget._vte.get_window_title() + if widget.get_window_title() is not None: + notebooklabel = widget.get_window_title() notebooktablabel = TerminatorNotebookTabLabel(notebooklabel, notebook, self) notebook.set_tab_label(child, notebooktablabel) notebook.set_tab_label_packing(child, True, True, gtk.PACK_START) @@ -515,13 +515,7 @@ class Terminator: notebook.append_page(terminal,None) terminal.show () terminal.spawn_child () - ## Some gtk/vte weirdness - ## 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() + notebooklabel = terminal.get_window_title() notebooktablabel = TerminatorNotebookTabLabel(notebooklabel, notebook, self) notebook.set_tab_label(terminal, notebooktablabel) notebook.set_tab_label_packing(terminal, True, True, gtk.PACK_START) diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index 75576187..e2a41b49 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -968,14 +968,16 @@ text/plain radioitem.connect ('activate', self.on_encoding_change, encoding[1]) 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 () if title is None: title = str(self.command) return title def on_vte_title_change(self, vte): - title = self.get_vte_window_title(vte) + title = self.get_window_title(vte) if self.conf.titletips: vte.set_property ("has-tooltip", True) vte.set_property ("tooltip-text", title) @@ -1001,7 +1003,7 @@ text/plain return 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())) notebookpage = self.terminator.get_first_notebook_page(vte) while notebookpage != None: