Show resource priority and status in section Status, the way nk proposed
This commit is contained in:
parent
e9e9c24d0a
commit
31a8b1a258
|
@ -582,7 +582,8 @@ class RosterTooltip(gtk.Window):
|
||||||
state_file = prim_contact.show.replace(' ', '_')
|
state_file = prim_contact.show.replace(' ', '_')
|
||||||
transport = self.plugin.roster.get_transport_name_by_jid(prim_contact.jid)
|
transport = self.plugin.roster.get_transport_name_by_jid(prim_contact.jid)
|
||||||
if transport:
|
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:
|
else:
|
||||||
iconset = gajim.config.get('iconset')
|
iconset = gajim.config.get('iconset')
|
||||||
if not iconset:
|
if not iconset:
|
||||||
|
@ -614,36 +615,34 @@ class RosterTooltip(gtk.Window):
|
||||||
info += '\n<span weight="bold">' + _('OpenPGP: ') + \
|
info += '\n<span weight="bold">' + _('OpenPGP: ') + \
|
||||||
'</span>' + keyID
|
'</span>' + keyID
|
||||||
|
|
||||||
resource_str, status_str, multiple_resource, multiple_status =\
|
single_line, resource_str, multiple_resource= '', '', False
|
||||||
'', '', False, False
|
|
||||||
for contact in contacts:
|
for contact in contacts:
|
||||||
if contact.resource:
|
if contact.resource:
|
||||||
if resource_str != '':
|
if resource_str != '':
|
||||||
multiple_resource = True
|
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 + \
|
resource_str += '\n\t' + contact.resource + \
|
||||||
' (' + str(contact.priority) + ')'
|
' (' + str(contact.priority) + ')'
|
||||||
if contact.show:
|
if contact.show:
|
||||||
if status_str != '':
|
if multiple_resource is False:
|
||||||
multiple_status = True
|
# keep a single line entry in case there are no resources/statuses
|
||||||
status_str += '\n\t' + helpers.get_uf_show(contact.show)
|
single_line += ": " + helpers.get_uf_show(contact.show)
|
||||||
|
resource_str += '\n\t\t' + helpers.get_uf_show(contact.show)
|
||||||
if contact.status:
|
if contact.status:
|
||||||
status_str += ' - ' + contact.status
|
resource_str += ' - ' + contact.status
|
||||||
|
if multiple_resource is False:
|
||||||
|
single_line += ' - ' + contact.status
|
||||||
|
|
||||||
if resource_str != '':
|
if resource_str != '':
|
||||||
info += '\n<span weight="bold">' + _('Resource: ') + '</span>'
|
info += '\n<span weight="bold">' + _('Status: ') + '</span>'
|
||||||
if multiple_resource:
|
if multiple_resource:
|
||||||
info += resource_str
|
info += resource_str
|
||||||
else:
|
else:
|
||||||
# show the status on the same line
|
# show the resource & status on the same line
|
||||||
info += resource_str[2:]
|
info += single_line
|
||||||
|
|
||||||
if status_str != '':
|
|
||||||
info += '\n<span weight="bold">' + _('Status: ') + '</span>'
|
|
||||||
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)
|
self.account.set_markup(info)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue