[pygobject] Add ObjectInfo.get_class_struct()



commit f22b95033c0bcd99e9c70e6f0dc999f5e64b08a6
Author: Johan Dahlin <johan gnome org>
Date:   Mon Oct 1 03:02:10 2012 -0700

    Add ObjectInfo.get_class_struct()
    
    https://bugzilla.gnome.org/show_bug.cgi?id=685218

 gi/pygi-info.c   |   15 +++++++++++++++
 tests/test_gi.py |    4 ++++
 2 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/gi/pygi-info.c b/gi/pygi-info.c
index 3bee1b1..097f439 100644
--- a/gi/pygi-info.c
+++ b/gi/pygi-info.c
@@ -1168,6 +1168,20 @@ _wrap_g_object_info_get_abstract (PyGIBaseInfo *self)
     return PyBool_FromLong (is_abstract);
 }
 
+static PyObject *
+_wrap_g_object_info_get_class_struct (PyGIBaseInfo *self)
+{
+    GIBaseInfo *info;
+
+    info = g_object_info_get_class_struct ((GIObjectInfo*)self->info);
+
+    if (info == NULL) {
+        Py_RETURN_NONE;
+    }
+
+    return _pygi_info_new (info);
+}
+
 static PyMethodDef _PyGIObjectInfo_methods[] = {
     { "get_parent", (PyCFunction) _wrap_g_object_info_get_parent, METH_NOARGS },
     { "get_methods", (PyCFunction) _wrap_g_object_info_get_methods, METH_NOARGS },
@@ -1176,6 +1190,7 @@ static PyMethodDef _PyGIObjectInfo_methods[] = {
     { "get_constants", (PyCFunction) _wrap_g_object_info_get_constants, METH_NOARGS },
     { "get_vfuncs", (PyCFunction) _wrap_g_object_info_get_vfuncs, METH_NOARGS },
     { "get_abstract", (PyCFunction) _wrap_g_object_info_get_abstract, METH_NOARGS },
+    { "get_class_struct", (PyCFunction) _wrap_g_object_info_get_class_struct, METH_NOARGS },
     { NULL, NULL, 0 }
 };
 
diff --git a/tests/test_gi.py b/tests/test_gi.py
index b6ef774..2f5e8cf 100644
--- a/tests/test_gi.py
+++ b/tests/test_gi.py
@@ -2867,6 +2867,10 @@ class TestObjectInfo(unittest.TestCase):
         info = repo.find_by_name('GObject', 'Object')
         self.assertFalse(info.get_abstract())
 
+    def test_get_class_struct(self):
+        self.assertEqual(GObject.Object.__info__.get_class_struct(),
+                         GObject.ObjectClass.__info__)
+
 
 class TestSignatureArgs(unittest.TestCase):
     def test_split_args_multi_out(self):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]