From d2941279d94d5525e6cc1b96eca2da1de4d7c99b Mon Sep 17 00:00:00 2001 From: epage Date: Sat, 18 Jul 2009 21:02:29 +0000 Subject: [PATCH] Made some contact code less likely to perma-freeze the UI git-svn-id: file:///svnroot/gc-dialer/trunk@367 c39d3808-3fe2-4d86-a59f-b7f623ee9f21 --- src/gc_views.py | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/gc_views.py b/src/gc_views.py index e428c3f..de52402 100644 --- a/src/gc_views.py +++ b/src/gc_views.py @@ -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): -- 1.7.9.5