diff options
author | Johan Dahlin <johan@src.gnome.org> | 2005-07-01 15:07:14 +0000 |
---|---|---|
committer | Johan Dahlin <johan@src.gnome.org> | 2005-07-01 15:07:14 +0000 |
commit | 70e4df9b3c1efbf1679a98f92682d84e1e343e50 (patch) | |
tree | 981d9a13ba62b11e8826d25f0153cd9c742f31ef | |
parent | 7ab5e094d7b690d272ee1fb2b55682ae9a969ec4 (diff) | |
download | pygtk-70e4df9b3c1efbf1679a98f92682d84e1e343e50.tar.gz |
Extend to add some new fields, add a getter for GType.type, which points
* gobject/pygtype.c: Extend to add some new fields, add a getter
for GType.type, which points to the python registered type
of a PyGTypeWrapper.
* gobject/gobjectmodule.c (initgobject): And register PyGTypeWrapper,
a side effect is that dir(gtype) also works now.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | gobject/gobjectmodule.c | 2 | ||||
-rw-r--r-- | gobject/pygtype.c | 31 |
3 files changed, 40 insertions, 2 deletions
@@ -1,3 +1,12 @@ +2005-07-01 Johan Dahlin <jdahlin@async.com.br> + + * gobject/pygtype.c: Extend to add some new fields, add a getter + for GType.type, which points to the python registered type + of a PyGTypeWrapper. + + * gobject/gobjectmodule.c (initgobject): And register PyGTypeWrapper, + a side effect is that dir(gtype) also works now. + 2005-06-27 John Finlay <finlay@moeraki.com> * gtk/gtk.override (_wrap_gtk_file_chooser_dialog_new) diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c index 061e591c..8882c0cc 100644 --- a/gobject/gobjectmodule.c +++ b/gobject/gobjectmodule.c @@ -2519,6 +2519,8 @@ initgobject(void) pyginterface_info_key = g_quark_from_static_string("PyGInterface::info"); pygpointer_class_key = g_quark_from_static_string("PyGPointer::class"); + PyType_Ready(&PyGTypeWrapper_Type); + PY_TYPE_OBJECT = g_boxed_type_register_static("PyObject", pyobject_copy, pyobject_free); diff --git a/gobject/pygtype.c b/gobject/pygtype.c index 73140a69..9b7816e7 100644 --- a/gobject/pygtype.c +++ b/gobject/pygtype.c @@ -60,6 +60,21 @@ pyg_type_wrapper_dealloc(PyGTypeWrapper *self) PyObject_DEL(self); } +static PyObject * +_wrap_g_type_wrapper__get_pytype(PyGTypeWrapper *self, void *closure) +{ + PyObject *py_type = Py_None; + + py_type = g_type_get_qdata(self->type, pygobject_class_key); + Py_INCREF(py_type); + return py_type; +} + +static PyGetSetDef _PyGTypeWrapper_getsets[] = { + { "pytype", (getter)_wrap_g_type_wrapper__get_pytype, (setter)0 }, + { NULL, 0, 0 }, +}; + PyTypeObject PyGTypeWrapper_Type = { PyObject_HEAD_INIT(NULL) 0, @@ -78,8 +93,20 @@ PyTypeObject PyGTypeWrapper_Type = { (hashfunc)pyg_type_wrapper_hash, (ternaryfunc)0, (reprfunc)0, - 0L,0L,0L,0L, - NULL + (getattrofunc)0, + (setattrofunc)0, + 0, + Py_TPFLAGS_DEFAULT, + NULL, + (traverseproc)0, + (inquiry)0, + (richcmpfunc)0, + 0, + (getiterfunc)0, + (iternextfunc)0, + 0, + 0, + _PyGTypeWrapper_getsets }; /** |