[gobject-introspection] scanner: Add GType for GVariant



commit 9fffe0160d211f798b57ecbb13dd3a28c5a671cf
Author: Colin Walters <walters verbum org>
Date:   Mon Sep 13 15:31:49 2010 -0400

    scanner: Add GType for GVariant
    
    This needs a manual override since GVariant is a fundamental.

 giscanner/gdumpparser.py |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/giscanner/gdumpparser.py b/giscanner/gdumpparser.py
index ea5794e..d23e93f 100644
--- a/giscanner/gdumpparser.py
+++ b/giscanner/gdumpparser.py
@@ -84,6 +84,7 @@ class GDumpParser(object):
         for node in self._namespace.itervalues():
             if isinstance(node, ast.Function):
                 self._initparse_function(node)
+
         if self._namespace.name == 'GObject':
             for node in self._namespace.itervalues():
                 if isinstance(node, ast.Record):
@@ -131,6 +132,13 @@ class GDumpParser(object):
         for node in to_remove:
             self._namespace.remove(node)
 
+        if self._namespace.name == 'GLib':
+            variant = self._namespace.get('Variant')
+            assert variant is not None
+            variant.add_gtype('GVariant', 'g_variant_get_gtype')
+            # Work around scanner bug
+            variant.disguised = False
+
     # Helper functions
 
     def _execute_binary_get_tree(self):
@@ -220,13 +228,10 @@ blob containing data gleaned from GObject's primitive introspection."""
 
     def _initparse_gobject_record(self, record):
         # Special handling for when we're parsing GObject
-        internal_names = ("Object", 'InitiallyUnowned')
-        if record.name in internal_names:
+        if record.name in ("Object", 'InitiallyUnowned'):
             self._create_gobject(record)
-            return
-        if record.name == 'InitiallyUnownedClass':
+        elif record.name == 'InitiallyUnownedClass':
             record.fields = self._namespace.get('ObjectClass').fields
-        self._namespace.append(record, replace=True)
 
     # Introspection over the data we get from the dynamic
     # GObject/GType system out of the binary



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