diff options
author | Tommi Komulainen <tko@src.gnome.org> | 2008-10-23 17:40:23 +0000 |
---|---|---|
committer | Tommi Komulainen <tko@src.gnome.org> | 2008-10-23 17:40:23 +0000 |
commit | 05935c0f3e197a95f9599146b056981a7932956c (patch) | |
tree | 08a5500a5f3ba69e508c120d4dddb6717bf0906e | |
parent | 01da6ccb1329696983ce9a0c753c62dcedeb037c (diff) | |
download | gobject-introspection-05935c0f3e197a95f9599146b056981a7932956c.tar.gz |
Check whether the parameter is a GObject from the GType
* giscanner/glibtransformer.py (_adjust_transfer): Check whether
the parameter is a GObject from its GType, if available.
svn path=/trunk/; revision=793
-rw-r--r-- | giscanner/glibtransformer.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/giscanner/glibtransformer.py b/giscanner/glibtransformer.py index c4a6029f..b666c920 100644 --- a/giscanner/glibtransformer.py +++ b/giscanner/glibtransformer.py @@ -781,6 +781,19 @@ class GLibTransformer(object): def _adjust_transfer(self, param): # Do GLib/GObject-specific type transformations here + is_object = None + if hasattr(param.type, '_gtype'): + ftype = cgobject.type_fundamental(param.type._gtype) + assert ftype != cgobject.TYPE_INVALID, param.type._gtype + + is_object = ftype in [cgobject.TYPE_OBJECT, + cgobject.TYPE_INTERFACE] + + if is_object is None: + is_object = (param.type.name == 'GObject.Object' or + (self._namespace_name == 'GObject' and + param.type.name == 'Object')) + # Default to full transfer for GObjects if isinstance(param, Parameter): is_out = (param.direction != PARAM_DIRECTION_IN) @@ -788,9 +801,7 @@ class GLibTransformer(object): is_out = True if (is_out and (param.transfer is None or param.transfer_inferred) and - (param.type.name == 'GObject.Object' or - (self._namespace_name == 'GObject' - and param.type.name == 'Object'))): + is_object): param.transfer = 'full' def _adjust_throws(self, func): |