From 31a8b1a258a394f143851d1c0cacd4fe4289ef57 Mon Sep 17 00:00:00 2001 From: Dimitur Kirov Date: Tue, 19 Jul 2005 15:05:01 +0000 Subject: [PATCH] Show resource priority and status in section Status, the way nk proposed --- src/dialogs.py | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/src/dialogs.py b/src/dialogs.py index 264db0e51..1b20ed007 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -582,7 +582,8 @@ class RosterTooltip(gtk.Window): state_file = prim_contact.show.replace(' ', '_') transport = self.plugin.roster.get_transport_name_by_jid(prim_contact.jid) if transport: - file_path = os.path.join(gajim.DATA_DIR, 'iconsets', 'transports', transport , '16x16') + file_path = os.path.join(gajim.DATA_DIR, 'iconsets', 'transports', + transport , '16x16') else: iconset = gajim.config.get('iconset') if not iconset: @@ -614,37 +615,35 @@ class RosterTooltip(gtk.Window): info += '\n' + _('OpenPGP: ') + \ '' + keyID - resource_str, status_str, multiple_resource, multiple_status =\ - '', '', False, False + single_line, resource_str, multiple_resource= '', '', False for contact in contacts: if contact.resource: if resource_str != '': multiple_resource = True + else: + # keep a single line entry in case there are no resources/statuses + single_line = contact.resource + ' (' + \ + str(contact.priority) + ')' resource_str += '\n\t' + contact.resource + \ ' (' + str(contact.priority) + ')' if contact.show: - if status_str != '': - multiple_status = True - status_str += '\n\t' + helpers.get_uf_show(contact.show) + if multiple_resource is False: + # keep a single line entry in case there are no resources/statuses + single_line += ": " + helpers.get_uf_show(contact.show) + resource_str += '\n\t\t' + helpers.get_uf_show(contact.show) if contact.status: - status_str += ' - ' + contact.status + resource_str += ' - ' + contact.status + if multiple_resource is False: + single_line += ' - ' + contact.status if resource_str != '': - info += '\n' + _('Resource: ') + '' + info += '\n' + _('Status: ') + '' if multiple_resource: info += resource_str else: - # show the status on the same line - info += resource_str[2:] + # show the resource & status on the same line + info += single_line - if status_str != '': - info += '\n' + _('Status: ') + '' - if not multiple_status: - # show the resource on the same line - info += status_str[2:] # remove \n\t - else: - info += status_str - self.account.set_markup(info) class InputDialog: