draw_contact doesn't draw the avatar anymore
new draw_avatar function that is called only when needed
This commit is contained in:
parent
109f599865
commit
5fa3da5538
2 changed files with 17 additions and 12 deletions
|
@ -665,7 +665,7 @@ class Interface:
|
||||||
# FIXME: this will be removed when we have the thread working
|
# FIXME: this will be removed when we have the thread working
|
||||||
win.show_avatar(jid, resource)
|
win.show_avatar(jid, resource)
|
||||||
# Show avatar in roster
|
# Show avatar in roster
|
||||||
self.roster.draw_contact(jid, account)
|
self.roster.draw_avatar(jid, account)
|
||||||
if self.remote is not None:
|
if self.remote is not None:
|
||||||
self.remote.raise_signal('VcardInfo', (account, vcard))
|
self.remote.raise_signal('VcardInfo', (account, vcard))
|
||||||
|
|
||||||
|
|
|
@ -191,6 +191,7 @@ class RosterWindow:
|
||||||
if gajim.groups[account][g]['expand']:
|
if gajim.groups[account][g]['expand']:
|
||||||
self.tree.expand_row(model.get_path(iterG), False)
|
self.tree.expand_row(model.get_path(iterG), False)
|
||||||
self.draw_contact(jid, account)
|
self.draw_contact(jid, account)
|
||||||
|
self.draw_avatar(jid, account)
|
||||||
|
|
||||||
def really_remove_contact(self, user, account):
|
def really_remove_contact(self, user, account):
|
||||||
if user.jid in gajim.newly_added[account]:
|
if user.jid in gajim.newly_added[account]:
|
||||||
|
@ -231,7 +232,7 @@ class RosterWindow:
|
||||||
return self.jabber_state_images
|
return self.jabber_state_images
|
||||||
|
|
||||||
def draw_contact(self, jid, account, selected = False, focus = False):
|
def draw_contact(self, jid, account, selected = False, focus = False):
|
||||||
'''draw the correct state image, name and avatar'''
|
'''draw the correct state image, name BUT not avatar'''
|
||||||
# focus is about if the roster window has toplevel-focus or not
|
# focus is about if the roster window has toplevel-focus or not
|
||||||
model = self.tree.get_model()
|
model = self.tree.get_model()
|
||||||
iters = self.get_contact_iter(jid, account)
|
iters = self.get_contact_iter(jid, account)
|
||||||
|
@ -261,6 +262,7 @@ class RosterWindow:
|
||||||
break
|
break
|
||||||
if add_acct:
|
if add_acct:
|
||||||
name += ' (' + account + ')'
|
name += ' (' + account + ')'
|
||||||
|
|
||||||
# add status msg, if not empty, under contact name in the treeview
|
# add status msg, if not empty, under contact name in the treeview
|
||||||
if contact.status and gajim.config.get('show_status_msgs_in_roster'):
|
if contact.status and gajim.config.get('show_status_msgs_in_roster'):
|
||||||
status = contact.status.strip()
|
status = contact.status.strip()
|
||||||
|
@ -276,8 +278,14 @@ class RosterWindow:
|
||||||
icon_name = helpers.get_icon_name_to_show(contact, account)
|
icon_name = helpers.get_icon_name_to_show(contact, account)
|
||||||
img = state_images[icon_name]
|
img = state_images[icon_name]
|
||||||
|
|
||||||
#FIXME: here it gets called to often
|
for iter in iters:
|
||||||
# for example if we recv a message we also reset the avatar!
|
model[iter][C_IMG] = img
|
||||||
|
model[iter][C_NAME] = name
|
||||||
|
|
||||||
|
def draw_avatar(self, jid, account):
|
||||||
|
'''draw the avatar'''
|
||||||
|
model = self.tree.get_model()
|
||||||
|
iters = self.get_contact_iter(jid, account)
|
||||||
if gajim.config.get('show_avatars_in_roster'):
|
if gajim.config.get('show_avatars_in_roster'):
|
||||||
pixbuf = gtkgui_helpers.get_avatar_pixbuf_from_cache(jid)
|
pixbuf = gtkgui_helpers.get_avatar_pixbuf_from_cache(jid)
|
||||||
if pixbuf in ('ask', None):
|
if pixbuf in ('ask', None):
|
||||||
|
@ -286,10 +294,7 @@ class RosterWindow:
|
||||||
scaled_pixbuf = gtkgui_helpers.get_scaled_pixbuf(pixbuf, 'roster')
|
scaled_pixbuf = gtkgui_helpers.get_scaled_pixbuf(pixbuf, 'roster')
|
||||||
else:
|
else:
|
||||||
scaled_pixbuf = None
|
scaled_pixbuf = None
|
||||||
|
|
||||||
for iter in iters:
|
for iter in iters:
|
||||||
model[iter][C_IMG] = img
|
|
||||||
model[iter][C_NAME] = name
|
|
||||||
model[iter][C_SECPIXBUF] = scaled_pixbuf
|
model[iter][C_SECPIXBUF] = scaled_pixbuf
|
||||||
|
|
||||||
def join_gc_room(self, account, room_jid, nick, password):
|
def join_gc_room(self, account, room_jid, nick, password):
|
||||||
|
|
Loading…
Add table
Reference in a new issue