diff options
author | Sayamindu Dasgupta <sayamindu@gmail.com> | 2009-05-04 22:59:51 (GMT) |
---|---|---|
committer | Sayamindu Dasgupta <sayamindu@gmail.com> | 2009-05-04 22:59:51 (GMT) |
commit | 3daa1767cda16404741ebbe3004c6294eee90e93 (patch) | |
tree | a8f32a96496eb5b14371c32111d118f084464008 | |
parent | 5f5785f60f1a9c55cf426b4c1497dbb401dcb22c (diff) |
Wrap a few more XklConfigRegistry functions
-rw-r--r-- | xklavier/xklavier.override | 256 |
1 files changed, 256 insertions, 0 deletions
diff --git a/xklavier/xklavier.override b/xklavier/xklavier.override index 5e0e0cc..e4c36c4 100644 --- a/xklavier/xklavier.override +++ b/xklavier/xklavier.override @@ -312,3 +312,259 @@ _wrap_xkl_config_registry_foreach_layout_variant(PyGObject *self, PyObject *args Py_INCREF(Py_None); return Py_None; } +%% +override xkl_config_registry_foreach_country kwargs +static void +pyxkl_config_foreach_country_cb(XklConfigRegistry * config, + const XklConfigItem * item, gpointer data) +{ + PyGILState_STATE state; + PyGtkCustomNotify *cunote = data; + PyObject *retobj, *py_item, *py_config; + gboolean ret = FALSE; + + state = pyg_gil_state_ensure(); + + py_config = pygobject_new((GObject *)config); + py_item = pygobject_new((GObject *)item); + + if (cunote->data) + retobj = PyObject_CallFunction(cunote->func, "NNO", py_config, + py_item, cunote->data); + else + retobj = PyObject_CallFunction(cunote->func, "NN", py_config, + py_item); + + if (retobj != NULL) { + Py_DECREF(retobj); + } else { + PyErr_Print(); + } + + pyg_gil_state_release(state); +} +static PyObject * +_wrap_xkl_config_registry_foreach_country(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "func", "data", NULL }; + PyObject *py_func, *py_data = NULL; + PyGtkCustomNotify cunote; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|O:xklavier.ConfigRegistry.foreach_country", + kwlist, &py_func, &py_data)) + return NULL; + + if (!PyCallable_Check(py_func)) { + PyErr_SetString(PyExc_TypeError, "func must be callable"); + return NULL; + } + + cunote.func = py_func; + cunote.data = py_data; + Py_INCREF(cunote.func); + Py_XINCREF(cunote.data); + + xkl_config_registry_foreach_country(XKL_CONFIG_REGISTRY(self->obj), + pyxkl_config_foreach_country_cb, + (gpointer)&cunote); + + Py_DECREF(cunote.func); + Py_XDECREF(cunote.data); + + Py_INCREF(Py_None); + return Py_None; +} +%% +override xkl_config_registry_foreach_country_variant kwargs +static void +pyxkl_config_foreach_country_variant_cb(XklConfigRegistry * config, + const XklConfigItem * item, const XklConfigItem *subitem, + gpointer data) +{ + PyGILState_STATE state; + PyGtkCustomNotify *cunote = data; + PyObject *retobj, *py_item, *py_subitem, *py_config; + gboolean ret = FALSE; + + state = pyg_gil_state_ensure(); + + py_config = pygobject_new((GObject *)config); + py_item = pygobject_new((GObject *)item); + py_subitem = pygobject_new((GObject *)subitem); + + if (cunote->data) + retobj = PyObject_CallFunction(cunote->func, "NNNO", py_config, + py_item, py_subitem, cunote->data); + else + retobj = PyObject_CallFunction(cunote->func, "NNN", py_config, + py_item, py_subitem); + + if (retobj != NULL) { + Py_DECREF(retobj); + } else { + PyErr_Print(); + } + + pyg_gil_state_release(state); +} +static PyObject * +_wrap_xkl_config_registry_foreach_country_variant(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "country_name", "func", "data", NULL }; + gchar *country_name; + PyObject *py_func, *py_data = NULL; + PyGtkCustomNotify cunote; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "sO|O:xklavier.ConfigRegistry.foreach_country_variant", + kwlist, &country_name, &py_func, &py_data)) + return NULL; + + if (!PyCallable_Check(py_func)) { + PyErr_SetString(PyExc_TypeError, "func must be callable"); + return NULL; + } + + cunote.func = py_func; + cunote.data = py_data; + Py_INCREF(cunote.func); + Py_XINCREF(cunote.data); + + xkl_config_registry_foreach_country_variant(XKL_CONFIG_REGISTRY(self->obj), country_name, + pyxkl_config_foreach_country_variant_cb, + (gpointer)&cunote); + + Py_DECREF(cunote.func); + Py_XDECREF(cunote.data); + + Py_INCREF(Py_None); + return Py_None; +} +%% +override xkl_config_registry_foreach_option_group kwargs +static void +pyxkl_config_foreach_option_group_cb(XklConfigRegistry * config, + const XklConfigItem * item, gpointer data) +{ + PyGILState_STATE state; + PyGtkCustomNotify *cunote = data; + PyObject *retobj, *py_item, *py_config; + gboolean ret = FALSE; + + state = pyg_gil_state_ensure(); + + py_config = pygobject_new((GObject *)config); + py_item = pygobject_new((GObject *)item); + + if (cunote->data) + retobj = PyObject_CallFunction(cunote->func, "NNO", py_config, + py_item, cunote->data); + else + retobj = PyObject_CallFunction(cunote->func, "NN", py_config, + py_item); + + if (retobj != NULL) { + Py_DECREF(retobj); + } else { + PyErr_Print(); + } + + pyg_gil_state_release(state); +} +static PyObject * +_wrap_xkl_config_registry_foreach_option_group(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "func", "data", NULL }; + PyObject *py_func, *py_data = NULL; + PyGtkCustomNotify cunote; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|O:xklavier.ConfigRegistry.foreach_option_group", + kwlist, &py_func, &py_data)) + return NULL; + + if (!PyCallable_Check(py_func)) { + PyErr_SetString(PyExc_TypeError, "func must be callable"); + return NULL; + } + + cunote.func = py_func; + cunote.data = py_data; + Py_INCREF(cunote.func); + Py_XINCREF(cunote.data); + + xkl_config_registry_foreach_option_group(XKL_CONFIG_REGISTRY(self->obj), + pyxkl_config_foreach_option_group_cb, + (gpointer)&cunote); + + Py_DECREF(cunote.func); + Py_XDECREF(cunote.data); + + Py_INCREF(Py_None); + return Py_None; +} +%% +override xkl_config_registry_foreach_option kwargs +static void +pyxkl_config_foreach_option_cb(XklConfigRegistry * config, + const XklConfigItem * item, gpointer data) +{ + PyGILState_STATE state; + PyGtkCustomNotify *cunote = data; + PyObject *retobj, *py_item, *py_config; + gboolean ret = FALSE; + + state = pyg_gil_state_ensure(); + + py_config = pygobject_new((GObject *)config); + py_item = pygobject_new((GObject *)item); + + if (cunote->data) + retobj = PyObject_CallFunction(cunote->func, "NNO", py_config, + py_item, cunote->data); + else + retobj = PyObject_CallFunction(cunote->func, "NN", py_config, + py_item); + + if (retobj != NULL) { + Py_DECREF(retobj); + } else { + PyErr_Print(); + } + + pyg_gil_state_release(state); +} +static PyObject * +_wrap_xkl_config_registry_foreach_option(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "option_group_name", "func", "data", NULL }; + gchar *option_group_name; + PyObject *py_func, *py_data = NULL; + PyGtkCustomNotify cunote; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "sO|O:xklavier.ConfigRegistry.foreach_option", + kwlist, &option_group_name, &py_func, &py_data)) + return NULL; + + if (!PyCallable_Check(py_func)) { + PyErr_SetString(PyExc_TypeError, "func must be callable"); + return NULL; + } + + cunote.func = py_func; + cunote.data = py_data; + Py_INCREF(cunote.func); + Py_XINCREF(cunote.data); + + xkl_config_registry_foreach_option(XKL_CONFIG_REGISTRY(self->obj), option_group_name, + pyxkl_config_foreach_option_cb, + (gpointer)&cunote); + + Py_DECREF(cunote.func); + Py_XDECREF(cunote.data); + + Py_INCREF(Py_None); + return Py_None; +} |