Window title fix for #1386

This commit is contained in:
Travis Shirk 2006-02-08 04:11:42 +00:00
parent 22721cb0db
commit 6d3696e83c
2 changed files with 26 additions and 11 deletions

View File

@ -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 = \
'<span weight="heavy" size="x-large">%s</span> %s' % (name,
chatstate)
'<span weight="heavy" size="x-large">%s</span>%s %s' % \
(name, acct_info, chatstate)
else:
label_text = '<span weight="heavy" size="x-large">%s</span>' % name
label_text = '<span weight="heavy" size="x-large">%s</span>%s' % \
(name, acct_info)
if status is not None:
label_text += '\n%s' % status

View File

@ -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)