quick app (contact list): when a new profile is plugged, updates are locked until the end of the process, this avoid many useless refreshes
This commit is contained in:
parent
8851addc20
commit
e8783b42df
1 changed files with 25 additions and 2 deletions
|
|
@ -215,6 +215,7 @@ class QuickApp(object):
|
|||
self.menus = quick_menus.QuickMenusManager(self)
|
||||
ProfileManager.host = self
|
||||
self.profiles = ProfilesManager()
|
||||
self._plugs_in_progress = set() # profiles currently being plugged, used to (un)lock contact list updates
|
||||
self.ready_profiles = set() # profiles which are connected and ready
|
||||
self.signals_cache = {} # used to keep signal received between start of plug_profile and when the profile is actualy ready
|
||||
self.contact_lists = quick_contact_list.QuickContactListHandler(self)
|
||||
|
|
@ -401,6 +402,7 @@ class QuickApp(object):
|
|||
|
||||
@param profile(unicode): %(doc_profile)s
|
||||
"""
|
||||
self._plugs_in_progress.remove(profile)
|
||||
self.ready_profiles.add(profile)
|
||||
|
||||
# profile is ready, we can call send signals that where is cache
|
||||
|
|
@ -410,6 +412,8 @@ class QuickApp(object):
|
|||
handler(*args, **kwargs)
|
||||
|
||||
self.callListeners('profilePlugged', profile=profile)
|
||||
if not self._plugs_in_progress:
|
||||
self.contact_lists.lockUpdate(False)
|
||||
|
||||
def asyncConnect(self, profile, callback=None, errback=None):
|
||||
if not callback:
|
||||
|
|
@ -428,6 +432,8 @@ class QuickApp(object):
|
|||
|
||||
@param profiles: list of valid profile names
|
||||
"""
|
||||
self.contact_lists.lockUpdate()
|
||||
self._plugs_in_progress.update(profiles)
|
||||
self.plugging_profiles()
|
||||
for profile in profiles:
|
||||
self.profiles.plug(profile)
|
||||
|
|
|
|||
Loading…
Reference in a new issue