summaryrefslogtreecommitdiff
path: root/gi/pygi-info.c
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2017-07-12 08:35:18 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2017-07-12 08:35:19 +0900
commitf29005349e245e146d416b2dc7a8f8a89a2e8a61 (patch)
tree454e51d5c655d539782db7f563a3f9740c0bea4b /gi/pygi-info.c
parentdf82aa0a770d4b3e52e96eb5c60b528ddcdb2343 (diff)
downloadpygobject2-f29005349e245e146d416b2dc7a8f8a89a2e8a61.tar.gz
pygobject2-f29005349e245e146d416b2dc7a8f8a89a2e8a61.tar.bz2
pygobject2-f29005349e245e146d416b2dc7a8f8a89a2e8a61.zip
Imported Upstream version 2.27.0
Change-Id: I194bad75f59fbd798f2049b3066248e7a672c9b9 Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'gi/pygi-info.c')
-rw-r--r--gi/pygi-info.c136
1 files changed, 122 insertions, 14 deletions
diff --git a/gi/pygi-info.c b/gi/pygi-info.c
index feeccf7..33f71c1 100644
--- a/gi/pygi-info.c
+++ b/gi/pygi-info.c
@@ -57,6 +57,34 @@ _base_info_repr (PyGIBaseInfo *self)
(void *) self);
}
+static PyObject *
+_base_info_richcompare (PyGIBaseInfo *self, PyObject *other, int op)
+{
+ PyObject *res;
+ GIBaseInfo *other_info;
+
+ if (!PyObject_TypeCheck(other, &PyGIBaseInfo_Type)) {
+ Py_INCREF(Py_NotImplemented);
+ return Py_NotImplemented;
+ }
+
+ other_info = ((PyGIBaseInfo *)other)->info;
+
+ switch (op) {
+ case Py_EQ:
+ res = g_base_info_equal (self->info, other_info) ? Py_True : Py_False;
+ break;
+ case Py_NE:
+ res = g_base_info_equal (self->info, other_info) ? Py_False : Py_True;
+ break;
+ default:
+ res = Py_NotImplemented;
+ break;
+ }
+ Py_INCREF(res);
+ return res;
+}
+
static PyMethodDef _PyGIBaseInfo_methods[];
PYGLIB_DEFINE_TYPE("gi.BaseInfo", PyGIBaseInfo_Type, PyGIBaseInfo);
@@ -113,14 +141,14 @@ _pygi_info_new (GIBaseInfo *info)
type = &PyGIFunctionInfo_Type;
break;
case GI_INFO_TYPE_CALLBACK:
- PyErr_SetString (PyExc_NotImplementedError, "GICallbackInfo bindings not implemented");
- return NULL;
+ type = &PyGICallbackInfo_Type;
+ break;
case GI_INFO_TYPE_STRUCT:
type = &PyGIStructInfo_Type;
break;
case GI_INFO_TYPE_BOXED:
- PyErr_SetString (PyExc_NotImplementedError, "GIBoxedInfo bindings not implemented");
- return NULL;
+ type = &PyGIBoxedInfo_Type;
+ break;
case GI_INFO_TYPE_ENUM:
case GI_INFO_TYPE_FLAGS:
type = &PyGIEnumInfo_Type;
@@ -135,8 +163,8 @@ _pygi_info_new (GIBaseInfo *info)
type = &PyGIConstantInfo_Type;
break;
case GI_INFO_TYPE_ERROR_DOMAIN:
- PyErr_SetString (PyExc_NotImplementedError, "GIErrorDomainInfo bindings not implemented");
- return NULL;
+ type = &PyGIErrorDomainInfo_Type;
+ break;
case GI_INFO_TYPE_UNION:
type = &PyGIUnionInfo_Type;
break;
@@ -144,23 +172,23 @@ _pygi_info_new (GIBaseInfo *info)
type = &PyGIValueInfo_Type;
break;
case GI_INFO_TYPE_SIGNAL:
- PyErr_SetString (PyExc_NotImplementedError, "GISignalInfo bindings not implemented");
- return NULL;
+ type = &PyGISignalInfo_Type;
+ break;
case GI_INFO_TYPE_VFUNC:
type = &PyGIVFuncInfo_Type;
break;
case GI_INFO_TYPE_PROPERTY:
- PyErr_SetString (PyExc_NotImplementedError, "GIPropertyInfo bindings not implemented");
- return NULL;
+ type = &PyGIPropertyInfo_Type;
+ break;
case GI_INFO_TYPE_FIELD:
type = &PyGIFieldInfo_Type;
break;
case GI_INFO_TYPE_ARG:
- PyErr_SetString (PyExc_NotImplementedError, "GIArgInfo bindings not implemented");
- return NULL;
+ type = &PyGIArgInfo_Type;
+ break;
case GI_INFO_TYPE_TYPE:
- PyErr_SetString (PyExc_NotImplementedError, "GITypeInfo bindings not implemented");
- return NULL;
+ type = &PyGITypeInfo_Type;
+ break;
case GI_INFO_TYPE_UNRESOLVED:
type = &PyGIUnresolvedInfo_Type;
break;
@@ -210,6 +238,55 @@ static PyMethodDef _PyGICallableInfo_methods[] = {
{ NULL, NULL, 0 }
};
+/* CallbackInfo */
+PYGLIB_DEFINE_TYPE ("gi.CallbackInfo", PyGICallbackInfo_Type, PyGIBaseInfo);
+
+static PyMethodDef _PyGICallbackInfo_methods[] = {
+ { NULL, NULL, 0 }
+};
+
+/* BoxedInfo */
+PYGLIB_DEFINE_TYPE ("gi.BoxedInfo", PyGIBoxedInfo_Type, PyGIBaseInfo);
+
+static PyMethodDef _PyGIBoxedInfo_methods[] = {
+ { NULL, NULL, 0 }
+};
+
+/* ErrorDomainInfo */
+PYGLIB_DEFINE_TYPE ("gi.ErrorDomainInfo", PyGIErrorDomainInfo_Type, PyGIBaseInfo);
+
+static PyMethodDef _PyGIErrorDomainInfo_methods[] = {
+ { NULL, NULL, 0 }
+};
+
+/* SignalInfo */
+PYGLIB_DEFINE_TYPE ("gi.SignalInfo", PyGISignalInfo_Type, PyGIBaseInfo);
+
+static PyMethodDef _PyGISignalInfo_methods[] = {
+ { NULL, NULL, 0 }
+};
+
+/* PropertyInfo */
+PYGLIB_DEFINE_TYPE ("gi.PropertyInfo", PyGIPropertyInfo_Type, PyGIBaseInfo);
+
+static PyMethodDef _PyGIPropertyInfo_methods[] = {
+ { NULL, NULL, 0 }
+};
+
+/* ArgInfo */
+PYGLIB_DEFINE_TYPE ("gi.ArgInfo", PyGIArgInfo_Type, PyGIBaseInfo);
+
+static PyMethodDef _PyGIArgInfo_methods[] = {
+ { NULL, NULL, 0 }
+};
+
+/* TypeInfo */
+PYGLIB_DEFINE_TYPE ("gi.TypeInfo", PyGITypeInfo_Type, PyGIBaseInfo);
+
+static PyMethodDef _PyGITypeInfo_methods[] = {
+ { NULL, NULL, 0 }
+};
+
/* FunctionInfo */
PYGLIB_DEFINE_TYPE ("gi.FunctionInfo", PyGIFunctionInfo_Type, PyGIBaseInfo);
@@ -1276,7 +1353,23 @@ static PyMethodDef _PyGIUnresolvedInfo_methods[] = {
/* GIVFuncInfo */
PYGLIB_DEFINE_TYPE ("gi.VFuncInfo", PyGIVFuncInfo_Type, PyGIBaseInfo);
+static PyObject *
+_wrap_g_vfunc_info_get_invoker (PyGIBaseInfo *self)
+{
+ PyObject *result = Py_None;
+ GIBaseInfo *info;
+
+ info = (GIBaseInfo *) g_vfunc_info_get_invoker ( (GIVFuncInfo *) self->info );
+ if (info)
+ result = _pygi_info_new(info);
+ else
+ Py_INCREF(Py_None);
+
+ return result;
+}
+
static PyMethodDef _PyGIVFuncInfo_methods[] = {
+ { "get_invoker", (PyCFunction) _wrap_g_vfunc_info_get_invoker, METH_NOARGS },
{ NULL, NULL, 0 }
};
@@ -1413,6 +1506,7 @@ _pygi_info_register_types (PyObject *m)
PyGIBaseInfo_Type.tp_traverse = (traverseproc) _base_info_traverse;
PyGIBaseInfo_Type.tp_weaklistoffset = offsetof(PyGIBaseInfo, inst_weakreflist);
PyGIBaseInfo_Type.tp_methods = _PyGIBaseInfo_methods;
+ PyGIBaseInfo_Type.tp_richcompare = (richcmpfunc)_base_info_richcompare;
if (PyType_Ready(&PyGIBaseInfo_Type))
return;
@@ -1424,6 +1518,8 @@ _pygi_info_register_types (PyObject *m)
PyGIBaseInfo_Type);
_PyGI_REGISTER_TYPE (m, PyGICallableInfo_Type, CallableInfo,
PyGIBaseInfo_Type);
+ _PyGI_REGISTER_TYPE (m, PyGICallbackInfo_Type, CallbackInfo,
+ PyGIBaseInfo_Type);
_PyGI_REGISTER_TYPE (m, PyGIFunctionInfo_Type, FunctionInfo,
PyGICallableInfo_Type);
_PyGI_REGISTER_TYPE (m, PyGIRegisteredTypeInfo_Type, RegisteredTypeInfo,
@@ -1446,6 +1542,18 @@ _pygi_info_register_types (PyObject *m)
PyGIBaseInfo_Type);
_PyGI_REGISTER_TYPE (m, PyGIUnionInfo_Type, UnionInfo,
PyGIRegisteredTypeInfo_Type);
+ _PyGI_REGISTER_TYPE (m, PyGIBoxedInfo_Type, BoxedInfo,
+ PyGIBaseInfo_Type);
+ _PyGI_REGISTER_TYPE (m, PyGIErrorDomainInfo_Type, ErrorDomainInfo,
+ PyGIBaseInfo_Type);
+ _PyGI_REGISTER_TYPE (m, PyGISignalInfo_Type, SignalInfo,
+ PyGIBaseInfo_Type);
+ _PyGI_REGISTER_TYPE (m, PyGIPropertyInfo_Type, PropertyInfo,
+ PyGIBaseInfo_Type);
+ _PyGI_REGISTER_TYPE (m, PyGIArgInfo_Type, ArgInfo,
+ PyGIBaseInfo_Type);
+ _PyGI_REGISTER_TYPE (m, PyGITypeInfo_Type, TypeInfo,
+ PyGIBaseInfo_Type);
#undef _PyGI_REGISTER_TYPE