summaryrefslogtreecommitdiff
path: root/src/python.cc
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2002-12-27 08:39:53 +0000
committerDana Jansens <danakj@orodu.net>2002-12-27 08:39:53 +0000
commitc645416035d64cc959d1dd0e937b31b07489e54b (patch)
treec8a3487cefe3c97e66c641ccc9cc51a713c3fc6a /src/python.cc
parent2c908c308df721762fef7c5dca0fcc465f474fd4 (diff)
add an unregister_all for python callbacks
Diffstat (limited to 'src/python.cc')
-rw-r--r--src/python.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/python.cc b/src/python.cc
index 97a3a4d2..ed171f9c 100644
--- a/src/python.cc
+++ b/src/python.cc
@@ -74,6 +74,20 @@ bool python_unregister(int action, PyObject *callback)
return true;
}
+bool python_unregister_all(int action)
+{
+ if (action < 0 || action >= OBActions::NUM_ACTIONS) {
+ PyErr_SetString(PyExc_AssertionError, "Invalid action type.");
+ return false;
+ }
+
+ while (!callbacks[action].empty()) {
+ Py_XDECREF(callbacks[action].back());
+ callbacks[action].pop_back();
+ }
+ return true;
+}
+
void python_callback(OBActions::ActionType action, Window window,
OBWidget::WidgetType type, unsigned int state,
long d1, long d2, long d3, long d4)