[gobject-introspection] Add boxed types definition for GLib



commit 7c93dc9534a4de5599f574043dcb688b8443ebad
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Fri Jun 3 19:10:42 2011 -0400

    Add boxed types definition for GLib
    
    Use the new glib-boxed.h header from gobject to pair structure
    definitions with boxed types in the GLib namespace, improving the
    introspection coverage and removing some hacks.
    
    Some fixes from Colin Walters <walters verbum org>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=646635

 Makefile-gir.am          |   14 ++++++++------
 giscanner/gdumpparser.py |   22 +++++-----------------
 2 files changed, 13 insertions(+), 23 deletions(-)
---
diff --git a/Makefile-gir.am b/Makefile-gir.am
index 2d23749..f32190f 100644
--- a/Makefile-gir.am
+++ b/Makefile-gir.am
@@ -3,7 +3,7 @@ SUBSTITUTED_GIRSOURCES =
 
 STATIC_GIRSOURCES =               \
         gir/DBus-1.0.gir           \
-        gir/DBusGLib-1.0.gir           \
+        gir/DBusGLib-1.0.gir        \
         gir/fontconfig-2.0.gir      \
         gir/freetype2-2.0.gir       \
         gir/GL-1.0.gir              \
@@ -62,7 +62,7 @@ else
 GLIB_LIBRARY=glib-2.0
 endif
 
-GLib_2_0_gir_LIBS = $(GLIB_LIBRARY)
+GLib_2_0_gir_LIBS = $(GLIB_LIBRARY) $(GOBJECT_LIBRARY)
 GLib_2_0_gir_SCANNERFLAGS = \
             --external-library \
             --reparse-validate \
@@ -80,7 +80,8 @@ GLib_2_0_gir_CFLAGS = \
             -D__G_I18N_LIB_H__
 GLib_2_0_gir_FILES =  \
                 $(GLIB_LIBDIR)/glib-2.0/include/glibconfig.h \
-	$(GLIB_INCLUDEDIR)/glib/*.h \
+		$(GLIB_INCLUDEDIR)/glib/*.h \
+		$(GLIB_INCLUDEDIR)/gobject/glib-types.h \
                 gir/glib-2.0.c
 
 BUILT_GIRSOURCES += GLib-2.0.gir
@@ -100,7 +101,6 @@ GOBJECT_LIBRARY=gobject-2.0
 endif
 
 GObject-2.0.gir: GLib-2.0.gir
-
 GObject_2_0_gir_LIBS = $(GOBJECT_LIBRARY)
 GObject_2_0_gir_SCANNERFLAGS = \
             --external-library \
@@ -114,9 +114,11 @@ GObject_2_0_gir_PACKAGES = gobject-2.0
 GObject_2_0_gir_INCLUDES = GLib-2.0
 GObject_2_0_gir_CFLAGS = \
             -DGOBJECT_COMPILATION \
-                -I$(GOBJECT_INCLUDEDIR) \
+            -I$(GOBJECT_INCLUDEDIR) \
             -I$(GOBJECT_LIBDIR)/glib-2.0/include
-GObject_2_0_gir_FILES = $(GLIB_INCLUDEDIR)/gobject/*.h gir/gobject-2.0.c
+GObject_2_0_gir_FILES = \
+	$(filter-out $(GOBJECT_INCLUDEDIR)/gobject/glib-types.h, $(wildcard $(GOBJECT_INCLUDEDIR)/gobject/*.h)) \
+	gir/gobject-2.0.c
 
 BUILT_GIRSOURCES += GObject-2.0.gir
 
diff --git a/giscanner/gdumpparser.py b/giscanner/gdumpparser.py
index 7e8f31f..650e194 100644
--- a/giscanner/gdumpparser.py
+++ b/giscanner/gdumpparser.py
@@ -133,14 +133,6 @@ 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')
-            variant.c_symbol_prefix = 'variant'
-            # Work around scanner bug
-            variant.disguised = False
-
     # Helper functions
 
     def _execute_binary_get_tree(self):
@@ -209,9 +201,6 @@ blob containing data gleaned from GObject's primitive introspection."""
             self._initparse_get_type_function(func)
 
     def _initparse_get_type_function(self, func):
-        if self._namespace.name == 'GLib':
-            # No GObjects in GLib
-            return False
         if (self._namespace.name == 'GObject' and
             func.symbol in ('g_object_get_type', 'g_initially_unowned_get_type')):
             # We handle these internally, see _create_gobject
@@ -455,14 +444,13 @@ different --identifier-prefix.""" % (xmlnode.attrib['name'], self._namespace.ide
         node.parent_chain = parent_types
 
     def _introspect_fundamental(self, xmlnode):
-        # We only care about types that can be instantiatable, other
-        # fundamental types such as the Clutter.Fixed/CoglFixed registers
-        # are not yet interesting from an introspection perspective and
-        # are ignored
-        if not xmlnode.attrib.get('instantiatable', False):
+        type_name = xmlnode.attrib['name']
+        if type_name == 'GVariant':
+            # HACK: make GVariant a boxed to avoid looking up GInitiallyUnowned
+            # when computing the default transfer ownership
+            self._introspect_boxed(xmlnode)
             return
 
-        type_name = xmlnode.attrib['name']
         is_abstract = bool(xmlnode.attrib.get('abstract', False))
         (get_type, c_symbol_prefix) = self._split_type_and_symbol_prefix(xmlnode)
         try:



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