Small bugfix and introduce a new function in roster window.

* draw_completely: draw contact, mood, activity... of a given jid
 * For metacontacts over several accounts, not all avatars were shown correctly when the second accounts connected
This commit is contained in:
Stephan Erb 2008-11-10 23:11:31 +00:00
parent 14482c1e36
commit 588f659d84

View file

@ -591,11 +591,7 @@ class RosterWindow:
brothers = self._add_metacontact_family(family, account) brothers = self._add_metacontact_family(family, account)
for c, acc in brothers: for c, acc in brothers:
self.draw_contact(c.jid, acc) self.draw_completely(c.jid, acc)
self.draw_mood(c.jid, acc)
self.draw_activity(c.jid, acc)
self.draw_tune(c.jid, acc)
self.draw_avatar(c.jid, acc)
def _get_nearby_family_and_big_brother(self, family, account): def _get_nearby_family_and_big_brother(self, family, account):
@ -639,11 +635,7 @@ class RosterWindow:
'self_contact', jid, account, None, None, None, None, 'self_contact', jid, account, None, None, None, None,
None)) None))
self.draw_contact(jid, account) self.draw_completely(jid, account)
self.draw_mood(jid, account)
self.draw_activity(jid, account)
self.draw_tune(jid, account)
self.draw_avatar(jid, account)
self.draw_account(account) self.draw_account(account)
return contact return contact
@ -699,11 +691,7 @@ class RosterWindow:
# Draw the contact and its groups contact # Draw the contact and its groups contact
if not self.starting: if not self.starting:
for c, acc in contacts: for c, acc in contacts:
self.draw_contact(c.jid, acc) self.draw_completely(c.jid, acc)
self.draw_mood(c.jid, acc)
self.draw_activity(c.jid, acc)
self.draw_tune(c.jid, acc)
self.draw_avatar(c.jid, acc)
for group in contact.get_shown_groups(): for group in contact.get_shown_groups():
self.draw_group(group, account) self.draw_group(group, account)
self._adjust_group_expand_collapse_state(group, account) self._adjust_group_expand_collapse_state(group, account)
@ -764,11 +752,7 @@ class RosterWindow:
# reshow the rest of the family # reshow the rest of the family
brothers = self._add_metacontact_family(family, account) brothers = self._add_metacontact_family(family, account)
for c, acc in brothers: for c, acc in brothers:
self.draw_contact(c.jid, acc) self.draw_completely(c.jid, acc)
self.draw_mood(c.jid, acc)
self.draw_activity(c.jid, acc)
self.draw_tune(c.jid, acc)
self.draw_avatar(c.jid, acc)
if iters: if iters:
# Draw all groups of the contact # Draw all groups of the contact
@ -808,7 +792,7 @@ class RosterWindow:
else: else:
contact.show = show contact.show = show
contact.status = status contact.status = status
self.draw_completely_and_show_if_needed(jid, account) self.adjust_and_draw_contact_context(jid, account)
return contact return contact
@ -1308,8 +1292,14 @@ class RosterWindow:
self.model[child_iter][C_AVATAR_PIXBUF] = scaled_pixbuf self.model[child_iter][C_AVATAR_PIXBUF] = scaled_pixbuf
return False return False
def draw_completely(self, jid, account):
self.draw_contact(jid, account)
self.draw_mood(jid, account)
self.draw_activity(jid, account)
self.draw_tune(jid, account)
self.draw_avatar(jid, account)
def draw_completely_and_show_if_needed(self, jid, account): def adjust_and_draw_contact_context(self, jid, account):
'''Draw contact, account and groups of given jid '''Draw contact, account and groups of given jid
Show contact if it has pending events Show contact if it has pending events
''' '''
@ -1338,11 +1328,15 @@ class RosterWindow:
''' '''
def _draw_all_contacts(jids, account): def _draw_all_contacts(jids, account):
for jid in jids: for jid in jids:
self.draw_contact(jid, account) family = gajim.contacts.get_metacontacts_family(account, jid)
self.draw_mood(jid, account) if family:
self.draw_activity(jid, account) # For metacontacts over several accounts:
self.draw_tune(jid, account) # When we connect a new account existing brothers
self.draw_avatar(jid, account) # must be redrawn (got removed and readded)
for data in family:
self.draw_completely(data['jid'], data['account'])
else:
self.draw_completely(jid, account)
yield True yield True
yield False yield False
@ -2062,7 +2056,7 @@ class RosterWindow:
pep.delete_pep(contact.jid, account) pep.delete_pep(contact.jid, account)
# Redraw everything and select the sender # Redraw everything and select the sender
self.draw_completely_and_show_if_needed(contact.jid, account) self.adjust_and_draw_contact_context(contact.jid, account)
def on_status_changed(self, account, status): def on_status_changed(self, account, status):
@ -3775,11 +3769,7 @@ class RosterWindow:
brothers = self._add_metacontact_family(new_family, account_source) brothers = self._add_metacontact_family(new_family, account_source)
for c, acc in brothers: for c, acc in brothers:
self.draw_contact(c.jid, acc) self.draw_completely(c.jid, acc)
self.draw_mood(c.jid, acc)
self.draw_activity(c.jid, acc)
self.draw_tune(c.jid, acc)
self.draw_avatar(c.jid, acc)
old_groups.extend(c_dest.groups) old_groups.extend(c_dest.groups)
for g in old_groups: for g in old_groups: