Commit 10f43be7 authored by Dan Pascu's avatar Dan Pascu

Use a transaction to update multiple elements at once

parent 6533f554
...@@ -200,6 +200,7 @@ class PresencePublicationHandler(object): ...@@ -200,6 +200,7 @@ class PresencePublicationHandler(object):
def _NH_CFGSettingsObjectDidChange(self, notification): def _NH_CFGSettingsObjectDidChange(self, notification):
if notification.sender is BlinkSettings(): if notification.sender is BlinkSettings():
# TODO: use a transaction here as well? -Dan
if 'presence.offline_note' in notification.data.modified: if 'presence.offline_note' in notification.data.modified:
self.set_xcap_offline_note() self.set_xcap_offline_note()
if 'presence.icon' in notification.data.modified: if 'presence.icon' in notification.data.modified:
...@@ -217,9 +218,9 @@ class PresencePublicationHandler(object): ...@@ -217,9 +218,9 @@ class PresencePublicationHandler(object):
account.icon = None account.icon = None
if set(['display_name', 'xcap.enabled', 'xcap.discovered']).intersection(notification.data.modified): if set(['display_name', 'xcap.enabled', 'xcap.discovered']).intersection(notification.data.modified):
if 'xcap.discovered' in notification.data.modified and account.xcap.enabled and account.xcap.discovered: if 'xcap.discovered' in notification.data.modified and account.xcap.enabled and account.xcap.discovered:
# TODO: group these in a transaction? Needs to be done in the file-io thread -Saul with account.xcap_manager.transaction():
self.set_xcap_offline_note(account) self.set_xcap_offline_note(account)
self.set_xcap_icon(account) self.set_xcap_icon(account)
self.publish(account) self.publish(account)
def _NH_SIPAccountWillActivate(self, notification): def _NH_SIPAccountWillActivate(self, notification):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment