One-to-one chat to MUC: set a beter tab name than the jid of the room. See #2095.

This commit is contained in:
Julien Pivotto 2008-05-17 14:00:27 +00:00
parent f6e74e22b6
commit 3d21a3b6b0
1 changed files with 25 additions and 12 deletions

View File

@ -464,7 +464,11 @@ class GroupchatControl(ChatControlBase):
if color_name: if color_name:
color = gtk.gdk.colormap_get_system().alloc_color(color_name) color = gtk.gdk.colormap_get_system().alloc_color(color_name)
label_str = self.name if self.is_continued:
# if this is a continued conversation
label_str = self.get_continued_conversation_name()
else:
label_str = self.name
# count waiting highlighted messages # count waiting highlighted messages
unread = '' unread = ''
@ -521,6 +525,23 @@ class GroupchatControl(ChatControlBase):
scaled_pix = pix.scale_simple(32, 32, gtk.gdk.INTERP_BILINEAR) scaled_pix = pix.scale_simple(32, 32, gtk.gdk.INTERP_BILINEAR)
banner_status_img.set_from_pixbuf(scaled_pix) banner_status_img.set_from_pixbuf(scaled_pix)
def get_continued_conversation_name(self):
'''Get the name of a continued conversation.
Will return Continued Conversation if there isn't any other
contact in the room
'''
nicks = []
for nick in gajim.contacts.get_nick_list(self.account,
self.room_jid):
if nick != self.nick:
nicks.append(nick)
if nicks != []:
title = ', '
title = _('Conversation with ') + title.join(nicks)
else:
title = _('Continued conversation')
return title
def draw_banner_text(self): def draw_banner_text(self):
'''Draw the text in the fat line at the top of the window that '''Draw the text in the fat line at the top of the window that
houses the room jid, subject. houses the room jid, subject.
@ -529,18 +550,10 @@ class GroupchatControl(ChatControlBase):
self.banner_status_label.set_ellipsize(pango.ELLIPSIZE_END) self.banner_status_label.set_ellipsize(pango.ELLIPSIZE_END)
font_attrs, font_attrs_small = self.get_font_attrs() font_attrs, font_attrs_small = self.get_font_attrs()
if self.is_continued: if self.is_continued:
nicks = [] name = self.get_continued_conversation_name()
for nick in gajim.contacts.get_nick_list(self.account, self.room_jid):
if nick != self.nick:
nicks.append(nick)
if nicks != []:
title = ', '
title = 'Conversation with ' + title.join(nicks)
else:
title = 'Continued conversation'
text = '<span %s>%s</span>' % (font_attrs, title)
else: else:
text = '<span %s>%s</span>' % (font_attrs, self.room_jid) name = self.room_jid
text = '<span %s>%s</span>' % (font_attrs, name)
self.name_label.set_markup(text) self.name_label.set_markup(text)
if self.subject: if self.subject: