core: plugins can now have profileConnected/profileDisconnected method to initialise/free profile dependant resources

This commit is contained in:
Goffi 2011-12-03 15:45:48 +01:00
commit 07b44d3170

View file

@ -247,6 +247,9 @@ class SAT(service.Service):
for plugin in self.plugins.iteritems():
if plugin[1].is_handler:
plugin[1].getHandler(profile).setHandlerParent(current)
connected_cb = getattr(plugin[1], "profileConnected", None)
if connected_cb:
connected_cb(profile)
current.startService()
@ -262,6 +265,10 @@ class SAT(service.Service):
profile = self.memory.getProfileName(profile_key)
info(_("Disconnecting..."))
self.profiles[profile].stopService()
for plugin in self.plugins.iteritems():
disconnected_cb = getattr(plugin[1], "profileDisconnected", None)
if disconnected_cb:
disconnected_cb(profile)
def purgeClient(self, profile):
"""Remove reference to a profile client and purge cache