Merge remote branch 'origin/pootle-import' into experimental
[enigma2.git] / lib / python / connections.cpp
1 #include <lib/python/connections.h>
2
3 PSignal::PSignal()
4 {
5 }
6
7 PSignal::~PSignal()
8 {
9         Py_XDECREF(m_list);
10 }
11
12 void PSignal::callPython(ePyObject tuple)
13 {
14         int size = PyList_Size(m_list);
15         int i;
16         for (i=0; i<size; ++i)
17         {
18                 ePyObject b = PyList_GET_ITEM(m_list, i);
19                 ePython::call(b, tuple);
20         }
21 }
22
23 PyObject *PSignal::get()
24 {
25         if (!m_list)
26                 m_list = PyList_New(0);
27         Py_INCREF(m_list);
28         return m_list;
29 }
30
31 PyObject *PSignal::getSteal(bool clear)
32 {
33         if (clear)
34         {
35                 ePyObject ret = m_list;
36                 m_list = (PyObject*)0;
37                 return ret;
38         }
39         return m_list;
40 }