[gobject-introspection/wip/docs: 21/23] ast: Make sure to export c:type for signals and properties



commit 3209fdf04bdff42033e1f833913c394adcaa2e67
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Feb 1 00:17:39 2013 -0500

    ast: Make sure to export c:type for signals and properties

 giscanner/ast.py                          |    3 +-
 tests/scanner/Annotation-1.0-expected.gir |   24 +++++++-------
 tests/scanner/Foo-1.0-expected.gir        |    8 ++--
 tests/scanner/Regress-1.0-expected.gir    |   46 ++++++++++++++--------------
 4 files changed, 41 insertions(+), 40 deletions(-)
---
diff --git a/giscanner/ast.py b/giscanner/ast.py
index 50b0f29..1831332 100644
--- a/giscanner/ast.py
+++ b/giscanner/ast.py
@@ -95,7 +95,8 @@ in contrast to the other create_type() functions."""
         # First, is it a fundamental?
         fundamental = type_names.get(gtype_name)
         if fundamental is not None:
-            return cls(target_fundamental=fundamental.target_fundamental)
+            return cls(target_fundamental=fundamental.target_fundamental,
+                       ctype=fundamental.ctype)
         if gtype_name == 'GHashTable':
             return Map(TYPE_ANY, TYPE_ANY, gtype_name=gtype_name)
         elif gtype_name in ('GArray', 'GPtrArray', 'GByteArray'):
diff --git a/tests/scanner/Annotation-1.0-expected.gir b/tests/scanner/Annotation-1.0-expected.gir
index bc0ae09..3abec0e 100644
--- a/tests/scanner/Annotation-1.0-expected.gir
+++ b/tests/scanner/Annotation-1.0-expected.gir
@@ -681,7 +681,7 @@ annotation_object_watch_full().</doc>
                 writable="1"
                 construct="1"
                 transfer-ownership="none">
-        <type name="Callback"/>
+        <type name="Callback" c:type="gpointer"/>
       </property>
       <property name="string-property"
                 version="1.0"
@@ -691,7 +691,7 @@ annotation_object_watch_full().</doc>
                 construct="1"
                 transfer-ownership="none">
         <doc xml:whitespace="preserve">This is a property which is a string</doc>
-        <type name="utf8"/>
+        <type name="utf8" c:type="gchar*"/>
       </property>
       <property name="tab-property"
                 version="1.2"
@@ -700,7 +700,7 @@ annotation_object_watch_full().</doc>
                 transfer-ownership="none">
         <doc xml:whitespace="preserve">This is a property annotation intentionally indented with a mix
 of tabs and strings to test the tab handling capabilities of the scanner.</doc>
-        <type name="utf8"/>
+        <type name="utf8" c:type="gchar*"/>
       </property>
       <field name="parent_instance">
         <type name="GObject.Object" c:type="GObject"/>
@@ -710,29 +710,29 @@ of tabs and strings to test the tab handling capabilities of the scanner.</doc>
         <return-value transfer-ownership="full">
           <attribute name="some.annotation.foo3" value="val3"/>
           <doc xml:whitespace="preserve">the return value</doc>
-          <type name="utf8"/>
+          <type name="utf8" c:type="gchar*"/>
         </return-value>
         <parameters>
           <parameter name="arg1" transfer-ownership="none">
             <attribute name="some.annotation.foo1" value="val1"/>
             <doc xml:whitespace="preserve">a value</doc>
-            <type name="utf8"/>
+            <type name="utf8" c:type="gchar*"/>
           </parameter>
           <parameter name="arg2" transfer-ownership="none">
             <attribute name="some.annotation.foo2" value="val2"/>
             <doc xml:whitespace="preserve">another value</doc>
-            <type name="utf8"/>
+            <type name="utf8" c:type="gchar*"/>
           </parameter>
         </parameters>
       </glib:signal>
       <glib:signal name="doc-empty-arg-parsing" when="last">
         <doc xml:whitespace="preserve">This signal tests an empty document argument (@arg1)</doc>
         <return-value transfer-ownership="none">
-          <type name="none"/>
+          <type name="none" c:type="void"/>
         </return-value>
         <parameters>
           <parameter name="arg1" transfer-ownership="none">
-            <type name="gpointer"/>
+            <type name="gpointer" c:type="gpointer"/>
           </parameter>
         </parameters>
       </glib:signal>
@@ -740,12 +740,12 @@ of tabs and strings to test the tab handling capabilities of the scanner.</doc>
         <doc xml:whitespace="preserve">This is a signal which takes a list of strings, but it's not
 known by GObject as it's only marked as G_TYPE_POINTER</doc>
         <return-value transfer-ownership="none">
-          <type name="none"/>
+          <type name="none" c:type="void"/>
         </return-value>
         <parameters>
           <parameter name="list" transfer-ownership="container">
             <doc xml:whitespace="preserve">a list of strings</doc>
-            <type name="GLib.List">
+            <type name="GLib.List" c:type="gpointer">
               <type name="utf8"/>
             </type>
           </parameter>
@@ -759,12 +759,12 @@ known by GObject as it's only marked as G_TYPE_POINTER</doc>
         <doc xml:whitespace="preserve">This is a signal which has a broken signal handler,
 it says it's pointer but it's actually a string.</doc>
         <return-value transfer-ownership="none">
-          <type name="none"/>
+          <type name="none" c:type="void"/>
         </return-value>
         <parameters>
           <parameter name="string" transfer-ownership="none">
             <doc xml:whitespace="preserve">a string</doc>
-            <type name="utf8"/>
+            <type name="utf8" c:type="gpointer"/>
           </parameter>
         </parameters>
       </glib:signal>
diff --git a/tests/scanner/Foo-1.0-expected.gir b/tests/scanner/Foo-1.0-expected.gir
index bfab266..40186df 100644
--- a/tests/scanner/Foo-1.0-expected.gir
+++ b/tests/scanner/Foo-1.0-expected.gir
@@ -666,7 +666,7 @@ uses a C sugar return type.</doc>
                 writable="1"
                 construct="1"
                 transfer-ownership="none">
-        <type name="utf8"/>
+        <type name="utf8" c:type="gchar*"/>
       </property>
       <field name="parent_instance">
         <type name="GObject.Object" c:type="GObject"/>
@@ -676,14 +676,14 @@ uses a C sugar return type.</doc>
       </field>
       <glib:signal name="signal" when="last">
         <return-value transfer-ownership="full">
-          <type name="utf8"/>
+          <type name="utf8" c:type="gchar*"/>
         </return-value>
         <parameters>
           <parameter name="object" transfer-ownership="none">
             <type name="GObject.Object"/>
           </parameter>
           <parameter name="p0" transfer-ownership="none">
-            <type name="gpointer"/>
+            <type name="gpointer" c:type="gpointer"/>
           </parameter>
         </parameters>
       </glib:signal>
@@ -960,7 +960,7 @@ exposed to language bindings.</doc>
       </method>
       <glib:signal name="destroy-event" when="last">
         <return-value transfer-ownership="none">
-          <type name="none"/>
+          <type name="none" c:type="void"/>
         </return-value>
       </glib:signal>
     </interface>
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir
index e5f9e3b..4f285eb 100644
--- a/tests/scanner/Regress-1.0-expected.gir
+++ b/tests/scanner/Regress-1.0-expected.gir
@@ -1277,13 +1277,13 @@ raise an error.</doc>
         <type name="TestBoxed"/>
       </property>
       <property name="double" writable="1" transfer-ownership="none">
-        <type name="gdouble"/>
+        <type name="gdouble" c:type="gdouble"/>
       </property>
       <property name="float" writable="1" transfer-ownership="none">
-        <type name="gfloat"/>
+        <type name="gfloat" c:type="gfloat"/>
       </property>
       <property name="gtype" writable="1" transfer-ownership="none">
-        <type name="GType"/>
+        <type name="GType" c:type="GType"/>
       </property>
       <property name="hash-table" writable="1" transfer-ownership="container">
         <type name="GLib.HashTable">
@@ -1300,20 +1300,20 @@ raise an error.</doc>
         </type>
       </property>
       <property name="int" writable="1" transfer-ownership="none">
-        <type name="gint"/>
+        <type name="gint" c:type="gint"/>
       </property>
       <property name="list" writable="1" transfer-ownership="none">
-        <type name="GLib.List">
+        <type name="GLib.List" c:type="gpointer">
           <type name="utf8"/>
         </type>
       </property>
       <property name="list-old" writable="1" transfer-ownership="none">
-        <type name="GLib.List">
+        <type name="GLib.List" c:type="gpointer">
           <type name="utf8"/>
         </type>
       </property>
       <property name="string" writable="1" transfer-ownership="none">
-        <type name="utf8"/>
+        <type name="utf8" c:type="gchar*"/>
       </property>
       <field name="parent_instance">
         <type name="GObject.Object" c:type="GObject"/>
@@ -1357,24 +1357,24 @@ raise an error.</doc>
                    action="1"
                    no-hooks="1">
         <return-value transfer-ownership="none">
-          <type name="none"/>
+          <type name="none" c:type="void"/>
         </return-value>
       </glib:signal>
       <glib:signal name="cleanup" when="cleanup">
         <return-value transfer-ownership="none">
-          <type name="none"/>
+          <type name="none" c:type="void"/>
         </return-value>
       </glib:signal>
       <glib:signal name="first" when="first">
         <return-value transfer-ownership="none">
-          <type name="none"/>
+          <type name="none" c:type="void"/>
         </return-value>
       </glib:signal>
       <glib:signal name="sig-with-array-prop" when="last">
         <doc xml:whitespace="preserve">This test signal is like TelepathyGlib's
  TpChannel:: group-members-changed-detailed:</doc>
         <return-value transfer-ownership="none">
-          <type name="none"/>
+          <type name="none" c:type="void"/>
         </return-value>
         <parameters>
           <parameter name="arr" transfer-ownership="none">
@@ -1387,7 +1387,7 @@ raise an error.</doc>
       </glib:signal>
       <glib:signal name="sig-with-foreign-struct" when="last">
         <return-value transfer-ownership="none">
-          <type name="none"/>
+          <type name="none" c:type="void"/>
         </return-value>
         <parameters>
           <parameter name="cr" transfer-ownership="none">
@@ -1400,7 +1400,7 @@ raise an error.</doc>
         <doc xml:whitespace="preserve">This test signal is like TelepathyGlib's
  TpAccount::status-changed</doc>
         <return-value transfer-ownership="none">
-          <type name="none"/>
+          <type name="none" c:type="void"/>
         </return-value>
         <parameters>
           <parameter name="hash" transfer-ownership="none">
@@ -1415,12 +1415,12 @@ raise an error.</doc>
         <doc xml:whitespace="preserve">You can use this with regress_test_obj_emit_sig_with_int64, or raise from
 the introspection client langage.</doc>
         <return-value transfer-ownership="none">
-          <type name="gint64"/>
+          <type name="gint64" c:type="gint64"/>
         </return-value>
         <parameters>
           <parameter name="i" transfer-ownership="none">
             <doc xml:whitespace="preserve">an integer</doc>
-            <type name="gint64"/>
+            <type name="gint64" c:type="gint64"/>
           </parameter>
         </parameters>
       </glib:signal>
@@ -1433,7 +1433,7 @@ the introspection client langage.</doc>
         <parameters>
           <parameter name="i" transfer-ownership="none">
             <doc xml:whitespace="preserve">an integer</doc>
-            <type name="gint"/>
+            <type name="gint" c:type="gint"/>
           </parameter>
         </parameters>
       </glib:signal>
@@ -1441,7 +1441,7 @@ the introspection client langage.</doc>
         <doc xml:whitespace="preserve">Test transfer none GObject as a param (tests refcounting).
 Use with regress_test_obj_emit_sig_with_obj</doc>
         <return-value transfer-ownership="none">
-          <type name="none"/>
+          <type name="none" c:type="void"/>
         </return-value>
         <parameters>
           <parameter name="obj" transfer-ownership="none">
@@ -1453,7 +1453,7 @@ Use with regress_test_obj_emit_sig_with_obj</doc>
       <glib:signal name="sig-with-strv" when="last">
         <doc xml:whitespace="preserve">Test GStrv as a param.</doc>
         <return-value transfer-ownership="none">
-          <type name="none"/>
+          <type name="none" c:type="void"/>
         </return-value>
         <parameters>
           <parameter name="strs" transfer-ownership="none">
@@ -1468,18 +1468,18 @@ Use with regress_test_obj_emit_sig_with_obj</doc>
         <doc xml:whitespace="preserve">You can use this with regress_test_obj_emit_sig_with_uint64, or raise from
 the introspection client langage.</doc>
         <return-value transfer-ownership="none">
-          <type name="guint64"/>
+          <type name="guint64" c:type="guint64"/>
         </return-value>
         <parameters>
           <parameter name="i" transfer-ownership="none">
             <doc xml:whitespace="preserve">an integer</doc>
-            <type name="guint64"/>
+            <type name="guint64" c:type="guint64"/>
           </parameter>
         </parameters>
       </glib:signal>
       <glib:signal name="test" when="last" no-recurse="1" no-hooks="1">
         <return-value transfer-ownership="none">
-          <type name="none"/>
+          <type name="none" c:type="void"/>
         </return-value>
       </glib:signal>
       <glib:signal name="test-with-static-scope-arg"
@@ -1487,7 +1487,7 @@ the introspection client langage.</doc>
                    no-recurse="1"
                    no-hooks="1">
         <return-value transfer-ownership="none">
-          <type name="none"/>
+          <type name="none" c:type="void"/>
         </return-value>
         <parameters>
           <parameter name="object" transfer-ownership="none">
@@ -1965,7 +1965,7 @@ the introspection client langage.</doc>
         </parameters>
       </method>
       <property name="testbool" writable="1" transfer-ownership="none">
-        <type name="gboolean"/>
+        <type name="gboolean" c:type="gboolean"/>
       </property>
       <field name="parent_instance">
         <type name="GObject.Object" c:type="GObject"/>



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