main/Makefile.am: fix code to generate version.h code is now als able to handle git...
[enigma2.git] / lib / python / connections.cpp
index c24c9399478a7bb994a5c72a6eb3ed05bf7ae14e..c0d38f8931a38c8a3fc1786ec9a60f6087f2d3ef 100644 (file)
@@ -1,9 +1,40 @@
 #include <lib/python/connections.h>
 
-PSignal1<void,int> testsignal;
+PSignal::PSignal()
+{
+}
+
+PSignal::~PSignal()
+{
+       Py_XDECREF(m_list);
+}
 
-void connect(Slot1<void, int> &slot, PyObject *fnc)
+void PSignal::callPython(ePyObject tuple)
 {
-       printf("CONNECT !\n");
+       int size = PyList_Size(m_list);
+       int i;
+       for (i=0; i<size; ++i)
+       {
+               ePyObject b = PyList_GET_ITEM(m_list, i);
+               ePython::call(b, tuple);
+       }
 }
 
+PyObject *PSignal::get()
+{
+       if (!m_list)
+               m_list = PyList_New(0);
+       Py_INCREF(m_list);
+       return m_list;
+}
+
+PyObject *PSignal::getSteal(bool clear)
+{
+       if (clear)
+       {
+               ePyObject ret = m_list;
+               m_list = (PyObject*)0;
+               return ret;
+       }
+       return m_list;
+}