]> Dogcows Code - chaz/openbox/blobdiff - src/python.cc
add an unregister_all for python callbacks
[chaz/openbox] / src / python.cc
index 97a3a4d2f38ba39a96d9f8d7f67ad57a9de24d4a..ed171f9cc4880659e2f3642dd310b606964751d4 100644 (file)
@@ -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)
This page took 0.020612 seconds and 4 git commands to generate.