improve tooltip code a little bit
This commit is contained in:
parent
e9f050d787
commit
5b48225d0c
|
@ -2768,9 +2768,9 @@ class RosterWindow:
|
|||
return
|
||||
if model[titer][C_TYPE] in ('contact', 'self_contact'):
|
||||
# we're on a contact entry in the roster
|
||||
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
||||
account = model[titer][C_ACCOUNT].decode('utf-8')
|
||||
jid = model[titer][C_JID].decode('utf-8')
|
||||
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
||||
self.tooltip.id = row
|
||||
contacts = gajim.contacts.get_contacts(account, jid)
|
||||
connected_contacts = []
|
||||
|
@ -2784,9 +2784,9 @@ class RosterWindow:
|
|||
self.tooltip.timeout = gobject.timeout_add(500,
|
||||
self.show_tooltip, connected_contacts)
|
||||
elif model[titer][C_TYPE] == 'groupchat':
|
||||
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
||||
account = model[titer][C_ACCOUNT].decode('utf-8')
|
||||
jid = model[titer][C_JID].decode('utf-8')
|
||||
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
||||
self.tooltip.id = row
|
||||
contact = gajim.contacts.get_contacts(account, jid)
|
||||
self.tooltip.account = account
|
||||
|
@ -2794,9 +2794,9 @@ class RosterWindow:
|
|||
self.show_tooltip, contact)
|
||||
elif model[titer][C_TYPE] == 'account':
|
||||
# we're on an account entry in the roster
|
||||
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
||||
account = model[titer][C_ACCOUNT].decode('utf-8')
|
||||
if account == 'all':
|
||||
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
||||
self.tooltip.id = row
|
||||
self.tooltip.account = None
|
||||
self.tooltip.timeout = gobject.timeout_add(500,
|
||||
|
@ -2807,11 +2807,13 @@ class RosterWindow:
|
|||
connection = gajim.connections[account]
|
||||
# get our current contact info
|
||||
|
||||
nbr_on, nbr_total = gajim.contacts.get_nb_online_total_contacts(
|
||||
nbr_on, nbr_total = gajim.\
|
||||
contacts.get_nb_online_total_contacts(
|
||||
accounts=[account])
|
||||
account_name = account
|
||||
if gajim.account_is_connected(account):
|
||||
account_name += ' (%s/%s)' % (repr(nbr_on), repr(nbr_total))
|
||||
account_name += ' (%s/%s)' % (repr(nbr_on),
|
||||
repr(nbr_total))
|
||||
contact = gajim.contacts.create_self_contact(jid=jid,
|
||||
account=account, name=account_name,
|
||||
show=connection.get_status(), status=connection.status,
|
||||
|
@ -2824,11 +2826,12 @@ class RosterWindow:
|
|||
# if we're online ...
|
||||
if connection.connection:
|
||||
roster = connection.connection.getRoster()
|
||||
# in threadless connection when no roster stanza is sent,
|
||||
# in threadless connection when no roster stanza is sent
|
||||
# 'roster' is None
|
||||
if roster and roster.getItem(jid):
|
||||
resources = roster.getResources(jid)
|
||||
# ...get the contact info for our other online resources
|
||||
# ...get the contact info for our other online
|
||||
# resources
|
||||
for resource in resources:
|
||||
# Check if we already have this resource
|
||||
found = False
|
||||
|
@ -2843,11 +2846,11 @@ class RosterWindow:
|
|||
show = 'online'
|
||||
contact = gajim.contacts.create_self_contact(
|
||||
jid=jid, account=account, show=show,
|
||||
status=roster.getStatus(jid + '/' + resource),
|
||||
status=roster.getStatus(
|
||||
jid + '/' + resource),
|
||||
priority=roster.getPriority(
|
||||
jid + '/' + resource), resource=resource)
|
||||
contacts.append(contact)
|
||||
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
||||
self.tooltip.id = row
|
||||
self.tooltip.account = None
|
||||
self.tooltip.timeout = gobject.timeout_add(500,
|
||||
|
|
Loading…
Reference in New Issue