gobject-introspection r781 - in trunk: . giscanner tests/scanner



Author: tko
Date: Wed Oct 22 10:46:22 2008
New Revision: 781
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=781&view=rev

Log:
Bug 557092 â Callback annotations not used

2008-10-22  Tommi Komulainen  <tommi komulainen iki fi>

	* giscanner/transformer.py (_create_callback): use annotations
	for callbacks
	* tests/scanner/annotation.h
	* tests/scanner/annotation-1.0-expected.gir: add tests

Modified:
   trunk/ChangeLog
   trunk/giscanner/transformer.py
   trunk/tests/scanner/annotation-1.0-expected.gir
   trunk/tests/scanner/annotation.h

Modified: trunk/giscanner/transformer.py
==============================================================================
--- trunk/giscanner/transformer.py	(original)
+++ trunk/giscanner/transformer.py	Wed Oct 22 10:46:22 2008
@@ -542,8 +542,11 @@
         return union
 
     def _create_callback(self, symbol):
-        parameters = self._create_parameters(symbol.base_type.base_type)
-        retval = self._create_return(symbol.base_type.base_type.base_type)
+        directives = symbol.directives()
+        parameters = self._create_parameters(symbol.base_type.base_type,
+            directives)
+        retval = self._create_return(symbol.base_type.base_type.base_type,
+            directives.get('return', {}))
         if symbol.ident.find('_') > 0:
             name = self.remove_prefix(symbol.ident, True)
         else:

Modified: trunk/tests/scanner/annotation-1.0-expected.gir
==============================================================================
--- trunk/tests/scanner/annotation-1.0-expected.gir	(original)
+++ trunk/tests/scanner/annotation-1.0-expected.gir	Wed Oct 22 10:46:22 2008
@@ -7,6 +7,30 @@
   <include name="GObject" version="2.0"/>
   <include name="utility" version="1.0"/>
   <namespace name="annotation" version="1.0" shared-library="annotation">
+    <callback name="Callback" c:type="AnnotationCallback">
+      <return-value transfer-ownership="none">
+        <type name="int" c:type="gint*"/>
+      </return-value>
+      <parameters>
+        <parameter name="in" transfer-ownership="none">
+          <type name="int" c:type="gint*"/>
+        </parameter>
+      </parameters>
+    </callback>
+    <callback name="ListCallback" c:type="AnnotationListCallback">
+      <return-value transfer-ownership="container">
+        <type name="GLib.List" c:type="GList*">
+          <type name="utf8"/>
+        </type>
+      </return-value>
+      <parameters>
+        <parameter name="in" transfer-ownership="none">
+          <type name="GLib.List" c:type="GList*">
+            <type name="utf8"/>
+          </type>
+        </parameter>
+      </parameters>
+    </callback>
     <class name="Object"
            c:type="AnnotationObject"
            parent="GObject.Object"

Modified: trunk/tests/scanner/annotation.h
==============================================================================
--- trunk/tests/scanner/annotation.h	(original)
+++ trunk/tests/scanner/annotation.h	Wed Oct 22 10:46:22 2008
@@ -3,6 +3,22 @@
 
 #include <glib-object.h>
 
+/**
+ * AnnotationCallback:
+ * @in: (in) (transfer none): array of ints
+ *
+ * Return value: (transfer none): array of ints
+ */
+typedef const gint* (*AnnotationCallback) (const gint *in);
+
+/**
+ * AnnotationListCallback:
+ * @in: (in) (transfer none) (element-type utf8): list of strings
+ *
+ * Return value: (transfer container) (element-type utf8): list of strings
+ */
+typedef GList* (*AnnotationListCallback) (GList *in);
+
 typedef struct _AnnotationObject          AnnotationObject;
 typedef struct _AnnotationObjectClass     AnnotationObjectClass;
 



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