fix icon in tooltip (sorry I can't test)
This commit is contained in:
parent
9024cf474e
commit
a67d009497
3 changed files with 23 additions and 19 deletions
|
@ -532,3 +532,19 @@ def get_global_show():
|
||||||
if connected > maxi:
|
if connected > maxi:
|
||||||
maxi = connected
|
maxi = connected
|
||||||
return gajim.SHOW_LIST[maxi]
|
return gajim.SHOW_LIST[maxi]
|
||||||
|
|
||||||
|
def get_icon_name_to_show(contact, account):
|
||||||
|
'''Get the icon name to show in online, away, requested, ...'''
|
||||||
|
if gajim.awaiting_events[account].has_key(contact.jid):
|
||||||
|
#FIXME: change icon for FT
|
||||||
|
return 'message'
|
||||||
|
if jid.find('@') <= 0: # if not '@' or '@' starts the jid ==> agent
|
||||||
|
return contact.show
|
||||||
|
if contact.sub in ('both', 'to'):
|
||||||
|
return contact.show
|
||||||
|
if contact.ask == 'subscribe':
|
||||||
|
return 'requested'
|
||||||
|
transport = gajim.get_transport_name_from_jid(contat.jid)
|
||||||
|
if transport:
|
||||||
|
return contact.show
|
||||||
|
return 'not in the roster'
|
||||||
|
|
|
@ -258,23 +258,8 @@ class RosterWindow:
|
||||||
% (colorstring, gtkgui_helpers.escape_for_pango_markup(status))
|
% (colorstring, gtkgui_helpers.escape_for_pango_markup(status))
|
||||||
|
|
||||||
state_images = self.get_appropriate_state_images(jid)
|
state_images = self.get_appropriate_state_images(jid)
|
||||||
if gajim.awaiting_events[account].has_key(jid):
|
icon_name = helpers.get_icon_name_to_show(account, contact)
|
||||||
#FIXME: change icon for FT
|
img = state_images[icon_name]
|
||||||
img = state_images['message']
|
|
||||||
elif jid.find('@') <= 0: # if not '@' or '@' starts the jid ==> agent
|
|
||||||
img = state_images[contact.show]
|
|
||||||
else:
|
|
||||||
if contact.sub in ('both', 'to'):
|
|
||||||
img = state_images[contact.show]
|
|
||||||
else:
|
|
||||||
if contact.ask == 'subscribe':
|
|
||||||
img = state_images['requested']
|
|
||||||
else:
|
|
||||||
transport = gajim.get_transport_name_from_jid(jid)
|
|
||||||
if transport and state_images.has_key(contact.show):
|
|
||||||
img = state_images[contact.show]
|
|
||||||
else:
|
|
||||||
img = state_images['not in the roster']
|
|
||||||
|
|
||||||
#FIXME: here it gets called to often
|
#FIXME: here it gets called to often
|
||||||
# for example if we recv a message we also reset the avatar!
|
# for example if we recv a message we also reset the avatar!
|
||||||
|
|
|
@ -362,6 +362,7 @@ class RosterTooltip(NotificationAreaTooltip):
|
||||||
self.hbox.set_spacing(0)
|
self.hbox.set_spacing(0)
|
||||||
self.create_table()
|
self.create_table()
|
||||||
if not contacts or len(contacts) == 0:
|
if not contacts or len(contacts) == 0:
|
||||||
|
# Tooltip for merged accounts row
|
||||||
accounts = self.get_accounts_info()
|
accounts = self.get_accounts_info()
|
||||||
self.current_row = 0
|
self.current_row = 0
|
||||||
self.table.resize(2, 1)
|
self.table.resize(2, 1)
|
||||||
|
@ -374,7 +375,8 @@ class RosterTooltip(NotificationAreaTooltip):
|
||||||
prim_contact = gajim.get_highest_prio_contact_from_contacts(contacts)
|
prim_contact = gajim.get_highest_prio_contact_from_contacts(contacts)
|
||||||
|
|
||||||
# try to find the image for the contact status
|
# try to find the image for the contact status
|
||||||
state_file = prim_contact.show.replace(' ', '_')
|
icon_name = helpers.get_icon_name_to_show(prim_contact)
|
||||||
|
state_file = icon_name.replace(' ', '_')
|
||||||
transport = gajim.get_transport_name_from_jid(prim_contact.jid)
|
transport = gajim.get_transport_name_from_jid(prim_contact.jid)
|
||||||
if transport:
|
if transport:
|
||||||
file_path = os.path.join(gajim.DATA_DIR, 'iconsets', 'transports',
|
file_path = os.path.join(gajim.DATA_DIR, 'iconsets', 'transports',
|
||||||
|
@ -424,7 +426,8 @@ class RosterTooltip(NotificationAreaTooltip):
|
||||||
if contact.resource:
|
if contact.resource:
|
||||||
status_line = self.get_status_info(contact.resource, contact.priority,
|
status_line = self.get_status_info(contact.resource, contact.priority,
|
||||||
contact.show, contact.status)
|
contact.show, contact.status)
|
||||||
self.add_status_row(file_path, contact.show, status_line)
|
icon_name = helpers.get_icon_name_to_show(contact)
|
||||||
|
self.add_status_row(file_path, icon_name, status_line)
|
||||||
|
|
||||||
else: # only one resource
|
else: # only one resource
|
||||||
if contact.resource:
|
if contact.resource:
|
||||||
|
|
Loading…
Add table
Reference in a new issue