From 6d3696e83c6b3c5c064b028d97e90125c555ad5f Mon Sep 17 00:00:00 2001 From: Travis Shirk Date: Wed, 8 Feb 2006 04:11:42 +0000 Subject: [PATCH] Window title fix for #1386 --- src/chat_control.py | 18 +++++++++++++++--- src/message_window.py | 19 +++++++++++-------- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/chat_control.py b/src/chat_control.py index f2f093beb..521140f53 100644 --- a/src/chat_control.py +++ b/src/chat_control.py @@ -841,6 +841,17 @@ class ChatControl(ChatControlBase): banner_name_label = self.xml.get_widget('banner_name_label') name = gtkgui_helpers.escape_for_pango_markup(contact.get_shown_name()) + + # We know our contacts nick, but if there are any other controls + # with the same nick we need to also display the account. + acct_info = '' + for ctrl in self.parent_win.controls(): + if ctrl == self: + continue + if self.contact.get_shown_name() == ctrl.contact.get_shown_name(): + acct_info = ' (%s)' % \ + gtkgui_helpers.escape_for_pango_markup(self.account) + break status = contact.status if status is not None: @@ -870,10 +881,11 @@ class ChatControl(ChatControlBase): else: chatstate = '' label_text = \ - '%s %s' % (name, - chatstate) + '%s%s %s' % \ + (name, acct_info, chatstate) else: - label_text = '%s' % name + label_text = '%s%s' % \ + (name, acct_info) if status is not None: label_text += '\n%s' % status diff --git a/src/message_window.py b/src/message_window.py index 2b1e06b7b..c1e74110a 100644 --- a/src/message_window.py +++ b/src/message_window.py @@ -219,15 +219,11 @@ class MessageWindow: else: name = control.contact.get_shown_name() - prefix = '' - if self.get_num_controls() > 1: - prefix = _('Chats: ') - #try to translate acct (which means account) to something short but - #that does make sense - account = ' (' + _('acct: ') + self.get_active_control().account + ')' - title = unread_str + prefix + name + account + title = _('Gajim Messages') + if gajim.interface.msg_win_mgr.mode == MessageWindowMgr.ONE_MSG_WINDOW_NEVER: + title = title + ": " + name - self.window.set_title(title) + self.window.set_title(unread_str + title) if urgent: gtkgui_helpers.set_unset_urgency_hint(self.window, unread) @@ -258,6 +254,13 @@ class MessageWindow: if len(self._controls[ctrl.account]) == 0: del self._controls[ctrl.account] + # Notify a dupicate nick to update their banner and clear account display + for c in self.controls(): + if c == self: + continue + if ctrl.contact.get_shown_name() == c.contact.get_shown_name(): + c.draw_banner() + if self.get_num_controls() == 1: # we are going from two tabs to one show_tabs_if_one_tab = gajim.config.get('tabs_always_visible') self.notebook.set_show_tabs(show_tabs_if_one_tab)