[pybank] Flag all new gtypes as using the new constructor API
- From: Johan Dahlin <johan src gnome org>
- To: svn-commits-list gnome org
- Subject: [pybank] Flag all new gtypes as using the new constructor API
- Date: Tue, 2 Jun 2009 10:46:18 -0400 (EDT)
commit d6a636cd5fa336b520fc6ac4664d0225caed90fb
Author: Tomeu Vizoso <tomeu sugarlabs org>
Date: Fri May 22 18:10:57 2009 +0200
Flag all new gtypes as using the new constructor API
---
bank/bank.c | 16 +++++++++++++++-
bank/btypes.py | 2 ++
2 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/bank/bank.c b/bank/bank.c
index 202eb7b..c63d5ed 100644
--- a/bank/bank.c
+++ b/bank/bank.c
@@ -34,8 +34,22 @@
type.tp_base = &base; \
REGISTER_TYPE(d, type, name)
+static PyObject *
+_wrap_set_object_has_new_constructor(PyGIBaseInfo *self, PyObject *args)
+{
+ PyObject *pygtype;
+
+ if (!PyArg_ParseTuple(args, "O:setObjectHasNewConstructor", &pygtype))
+ return NULL;
+
+ pyg_set_object_has_new_constructor(pyg_type_from_object(pygtype));
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
static PyMethodDef pybank_functions[] = {
- //{ "getParamType", (PyCFunction)_wrap_g_type_info_get_param_type, METH_VARARGS },
+ { "setObjectHasNewConstructor", (PyCFunction)_wrap_set_object_has_new_constructor, METH_VARARGS },
{ NULL, NULL, 0 }
};
diff --git a/bank/btypes.py b/bank/btypes.py
index 32c0070..bf637a2 100644
--- a/bank/btypes.py
+++ b/bank/btypes.py
@@ -195,6 +195,8 @@ class PyBankMeta(gobject.GObjectMeta):
if hasattr(cls.__info__, 'getFields'):
cls._setup_fields()
+ repo.setObjectHasNewConstructor(cls.__gtype__)
+
def _setup_methods(cls, needs_constructor):
info = cls.__info__
constructors = []
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]