[pygobject] Implement marshalling for GParamSpec
- From: Martin Pitt <martinpitt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Implement marshalling for GParamSpec
- Date: Mon, 20 Aug 2012 20:55:43 +0000 (UTC)
commit 5cd18c9bd59a60b930ced0b35d728c12bb3291c7
Author: Mathieu Duponchelle <mathieu duponchelle epitech eu>
Date: Mon Aug 20 22:54:52 2012 +0200
Implement marshalling for GParamSpec
https://bugzilla.gnome.org/show_bug.cgi?id=681565
Co-Authored-By: Martin Pitt <martinpitt gnome org>
gi/pygi-marshal-to-py.c | 16 ++++++++++++----
tests/test_gi.py | 14 ++++++++++++++
2 files changed, 26 insertions(+), 4 deletions(-)
---
diff --git a/gi/pygi-marshal-to-py.c b/gi/pygi-marshal-to-py.c
index a80036a..811d8b0 100644
--- a/gi/pygi-marshal-to-py.c
+++ b/gi/pygi-marshal-to-py.c
@@ -879,10 +879,18 @@ _pygi_marshal_to_py_interface_object (PyGIInvokeState *state,
return py_obj;
}
- py_obj = pygobject_new (arg->v_pointer);
-
- if (arg_cache->transfer == GI_TRANSFER_EVERYTHING)
- g_object_unref (arg->v_pointer);
+ if (G_IS_PARAM_SPEC(arg->v_pointer))
+ {
+ py_obj = pyg_param_spec_new (arg->v_pointer);
+ if (arg_cache->transfer == GI_TRANSFER_EVERYTHING)
+ g_param_spec_unref (arg->v_pointer);
+ }
+ else
+ {
+ py_obj = pygobject_new (arg->v_pointer);
+ if (arg_cache->transfer == GI_TRANSFER_EVERYTHING)
+ g_object_unref (arg->v_pointer);
+ }
return py_obj;
}
diff --git a/tests/test_gi.py b/tests/test_gi.py
index 3862334..fbe832c 100644
--- a/tests/test_gi.py
+++ b/tests/test_gi.py
@@ -2067,6 +2067,20 @@ class TestGErrorReturn(unittest.TestCase):
self.assertEqual(error.message, GIMarshallingTests.CONSTANT_GERROR_MESSAGE)
+class TestParamSpec(unittest.TestCase):
+ def test_param_spec_return(self):
+ obj = GIMarshallingTests.param_spec_return()
+ self.assertEqual(obj.name, 'test-param')
+ self.assertEqual(obj.nick, 'test')
+ self.assertEqual(obj.value_type, GObject.TYPE_STRING)
+
+ def test_param_spec_out(self):
+ obj = GIMarshallingTests.param_spec_out()
+ self.assertEqual(obj.name, 'test-param')
+ self.assertEqual(obj.nick, 'test')
+ self.assertEqual(obj.value_type, GObject.TYPE_STRING)
+
+
class TestKeywordArgs(unittest.TestCase):
def test_calling(self):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]