summaryrefslogtreecommitdiffstats
path: root/libvirt-override-virStream.py
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2011-06-14 13:49:22 -0400
committerCole Robinson <crobinso@redhat.com>2011-06-20 14:11:55 -0400
commit8f2990bffe64b6d9392abd60a2bdc6da3a9aeafd (patch)
tree9202a9a12730d7628da0f574ce3957d3808ab499 /libvirt-override-virStream.py
parent6d991ee5d29f4a9aa6636fa9ed8ffbbe21339b0a (diff)
downloadlibvirt-python-v6-8f2990bffe64b6d9392abd60a2bdc6da3a9aeafd.tar.gz
libvirt-python-v6-8f2990bffe64b6d9392abd60a2bdc6da3a9aeafd.tar.xz
libvirt-python-v6-8f2990bffe64b6d9392abd60a2bdc6da3a9aeafd.zip
python: Implement bindings for virStreamEventAddCallback
v2: Don't generate virStreamFree
Diffstat (limited to 'libvirt-override-virStream.py')
-rw-r--r--libvirt-override-virStream.py24
1 files changed, 15 insertions, 9 deletions
diff --git a/libvirt-override-virStream.py b/libvirt-override-virStream.py
index f50a7ef..56f1df5 100644
--- a/libvirt-override-virStream.py
+++ b/libvirt-override-virStream.py
@@ -9,12 +9,18 @@
libvirtmod.virStreamFree(self._o)
self._o = None
- def eventAddCallback(self, cb, opaque):
- """ """
- try:
- self.cb = cb
- self.opaque = opaque
- ret = libvirtmod.virStreamEventAddCallback(self._o, self)
- if ret == -1: raise libvirtError ('virStreamEventAddCallback() failed', conn=self._conn)
- except AttributeError:
- pass
+ def dispatchStreamEventCallback(self, events, cbData):
+ """
+ Dispatches events to python user's stream event callbacks
+ """
+ cb = cbData["cb"]
+ opaque = cbData["opaque"]
+
+ cb(self, events, opaque)
+ return 0
+
+ def eventAddCallback(self, events, cb, opaque):
+ self.cb = cb
+ cbData = {"stream": self, "cb" : cb, "opaque" : opaque}
+ ret = libvirtmod.virStreamEventAddCallback(self._o, events, cbData)
+ if ret == -1: raise libvirtError ('virStreamEventAddCallback() failed')