Skip to content
Browse files

Can remove contact if he goes unavailable

  • Loading branch information...
1 parent 74e1efd commit e03866dcebc9461eaf7a8add36b299884a318414 @zhangsen committed
Showing with 7 additions and 5 deletions.
  1. +7 −5 contact_selector.py
View
12 contact_selector.py
@@ -154,11 +154,7 @@ def _contact_presence_changed_cb(self, presences):
def _remove_contact(self, handle):
del self._contact_list[handle]
- # TODO how to remove from ListStore?
- # Use bruteforce for now; iterating through liststore and find it
- for row in self:
- if row[0] == handle:
- self.remove(row.iter)
+ self._list_store.remove_contact(self._conn, handle)
def _error_cb(self, *args):
logger.error("Error happends: %s" % args)
@@ -205,6 +201,12 @@ def add_contact(self, conn, handle, contact):
conn and handle are used to uniquely refer to a certain row/contact"""
self.append((conn.service_name, handle, contact.presence[1], contact.alias))
+ def remove_contact(self, conn, handle):
+ # TODO how to remove from ListStore?
+ # Use bruteforce for now; iterating through liststore and find it
+ for row in self:
+ if (row[0], row[1]) == (conn.service_name, handle):
+ self.remove(row.iter)
class ContactSelector(gtk.ComboBox):
"""A ComboBox that display a list of contact"""

0 comments on commit e03866d

Please sign in to comment.
Something went wrong with that request. Please try again.