improve tooltip code a little bit
This commit is contained in:
parent
e9f050d787
commit
5b48225d0c
1 changed files with 60 additions and 57 deletions
|
@ -2768,9 +2768,9 @@ class RosterWindow:
|
||||||
return
|
return
|
||||||
if model[titer][C_TYPE] in ('contact', 'self_contact'):
|
if model[titer][C_TYPE] in ('contact', 'self_contact'):
|
||||||
# we're on a contact entry in the roster
|
# 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')
|
account = model[titer][C_ACCOUNT].decode('utf-8')
|
||||||
jid = model[titer][C_JID].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
|
self.tooltip.id = row
|
||||||
contacts = gajim.contacts.get_contacts(account, jid)
|
contacts = gajim.contacts.get_contacts(account, jid)
|
||||||
connected_contacts = []
|
connected_contacts = []
|
||||||
|
@ -2784,9 +2784,9 @@ class RosterWindow:
|
||||||
self.tooltip.timeout = gobject.timeout_add(500,
|
self.tooltip.timeout = gobject.timeout_add(500,
|
||||||
self.show_tooltip, connected_contacts)
|
self.show_tooltip, connected_contacts)
|
||||||
elif model[titer][C_TYPE] == 'groupchat':
|
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')
|
account = model[titer][C_ACCOUNT].decode('utf-8')
|
||||||
jid = model[titer][C_JID].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
|
self.tooltip.id = row
|
||||||
contact = gajim.contacts.get_contacts(account, jid)
|
contact = gajim.contacts.get_contacts(account, jid)
|
||||||
self.tooltip.account = account
|
self.tooltip.account = account
|
||||||
|
@ -2794,9 +2794,9 @@ class RosterWindow:
|
||||||
self.show_tooltip, contact)
|
self.show_tooltip, contact)
|
||||||
elif model[titer][C_TYPE] == 'account':
|
elif model[titer][C_TYPE] == 'account':
|
||||||
# we're on an account entry in the roster
|
# 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')
|
account = model[titer][C_ACCOUNT].decode('utf-8')
|
||||||
if account == 'all':
|
if account == 'all':
|
||||||
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
|
||||||
self.tooltip.id = row
|
self.tooltip.id = row
|
||||||
self.tooltip.account = None
|
self.tooltip.account = None
|
||||||
self.tooltip.timeout = gobject.timeout_add(500,
|
self.tooltip.timeout = gobject.timeout_add(500,
|
||||||
|
@ -2807,11 +2807,13 @@ class RosterWindow:
|
||||||
connection = gajim.connections[account]
|
connection = gajim.connections[account]
|
||||||
# get our current contact info
|
# 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])
|
accounts=[account])
|
||||||
account_name = account
|
account_name = account
|
||||||
if gajim.account_is_connected(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,
|
contact = gajim.contacts.create_self_contact(jid=jid,
|
||||||
account=account, name=account_name,
|
account=account, name=account_name,
|
||||||
show=connection.get_status(), status=connection.status,
|
show=connection.get_status(), status=connection.status,
|
||||||
|
@ -2824,11 +2826,12 @@ class RosterWindow:
|
||||||
# if we're online ...
|
# if we're online ...
|
||||||
if connection.connection:
|
if connection.connection:
|
||||||
roster = connection.connection.getRoster()
|
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
|
# 'roster' is None
|
||||||
if roster and roster.getItem(jid):
|
if roster and roster.getItem(jid):
|
||||||
resources = roster.getResources(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:
|
for resource in resources:
|
||||||
# Check if we already have this resource
|
# Check if we already have this resource
|
||||||
found = False
|
found = False
|
||||||
|
@ -2843,11 +2846,11 @@ class RosterWindow:
|
||||||
show = 'online'
|
show = 'online'
|
||||||
contact = gajim.contacts.create_self_contact(
|
contact = gajim.contacts.create_self_contact(
|
||||||
jid=jid, account=account, show=show,
|
jid=jid, account=account, show=show,
|
||||||
status=roster.getStatus(jid + '/' + resource),
|
status=roster.getStatus(
|
||||||
|
jid + '/' + resource),
|
||||||
priority=roster.getPriority(
|
priority=roster.getPriority(
|
||||||
jid + '/' + resource), resource=resource)
|
jid + '/' + resource), resource=resource)
|
||||||
contacts.append(contact)
|
contacts.append(contact)
|
||||||
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
|
||||||
self.tooltip.id = row
|
self.tooltip.id = row
|
||||||
self.tooltip.account = None
|
self.tooltip.account = None
|
||||||
self.tooltip.timeout = gobject.timeout_add(500,
|
self.tooltip.timeout = gobject.timeout_add(500,
|
||||||
|
|
Loading…
Add table
Reference in a new issue