gobject-introspection r793 - trunk/giscanner



Author: tko
Date: Thu Oct 23 17:40:23 2008
New Revision: 793
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=793&view=rev

Log:
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.

Modified:
   trunk/giscanner/glibtransformer.py

Modified: trunk/giscanner/glibtransformer.py
==============================================================================
--- trunk/giscanner/glibtransformer.py	(original)
+++ trunk/giscanner/glibtransformer.py	Thu Oct 23 17:40:23 2008
@@ -781,6 +781,19 @@
     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 @@
             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):



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