Made some contact code less likely to perma-freeze the UI
authorepage <eopage@byu.net>
Sat, 18 Jul 2009 21:02:29 +0000 (21:02 +0000)
committerepage <eopage@byu.net>
Sat, 18 Jul 2009 21:02:29 +0000 (21:02 +0000)
git-svn-id: file:///svnroot/gc-dialer/trunk@367 c39d3808-3fe2-4d86-a59f-b7f623ee9f21

src/gc_views.py

index e428c3f..de52402 100644 (file)
@@ -1057,22 +1057,24 @@ class ContactsView(object):
 
                # completely disable updating the treeview while we populate the data
                self._contactsview.freeze_child_notify()
-               self._contactsview.set_model(None)
-
-               addressBook = self._addressBook
                try:
-                       contacts = addressBook.get_contacts()
-               except RuntimeError, e:
-                       contacts = []
-                       self._isPopulated = False
-                       self._errorDisplay.push_exception_with_lock(e)
-               for contactId, contactName in contacts:
-                       contactType = (addressBook.contact_source_short_name(contactId), )
-                       self._contactsmodel.append(contactType + (contactName, "", contactId) + ("", ))
-
-               # restart the treeview data rendering
-               self._contactsview.set_model(self._contactsmodel)
-               self._contactsview.thaw_child_notify()
+                       self._contactsview.set_model(None)
+
+                       addressBook = self._addressBook
+                       try:
+                               contacts = addressBook.get_contacts()
+                       except RuntimeError, e:
+                               contacts = []
+                               self._isPopulated = False
+                               self._errorDisplay.push_exception_with_lock(e)
+                       for contactId, contactName in contacts:
+                               contactType = (addressBook.contact_source_short_name(contactId), )
+                               self._contactsmodel.append(contactType + (contactName, "", contactId) + ("", ))
+
+                       # restart the treeview data rendering
+                       self._contactsview.set_model(self._contactsmodel)
+               finally:
+                       self._contactsview.thaw_child_notify()
                return False
 
        def _on_addressbook_combo_changed(self, *args, **kwds):