gobject-introspection r360 - in trunk: . giscanner



Author: johan
Date: Wed Aug 13 21:25:15 2008
New Revision: 360
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=360&view=rev

Log:
2008-08-13  Johan Dahlin  <johan gnome org>

    * giscanner/cgobject.py:
    Register GInitiallyUnowned
    * giscanner/girwriter.py:
    * giscanner/glibtransformer.py:
    Special case GObject/GInitially owned as they are a bit special to use.



Modified:
   trunk/ChangeLog
   trunk/giscanner/cgobject.py
   trunk/giscanner/girwriter.py
   trunk/giscanner/glibtransformer.py

Modified: trunk/giscanner/cgobject.py
==============================================================================
--- trunk/giscanner/cgobject.py	(original)
+++ trunk/giscanner/cgobject.py	Wed Aug 13 21:25:15 2008
@@ -145,6 +145,7 @@
 # which happens when trying to introspect an interface before instantiating
 # a GObject.
 _gobj.g_object_new(TYPE_OBJECT, None)
+_gobj.g_initially_unowned_get_type()
 
 # Functions
 

Modified: trunk/giscanner/girwriter.py
==============================================================================
--- trunk/giscanner/girwriter.py	(original)
+++ trunk/giscanner/girwriter.py	Wed Aug 13 21:25:15 2008
@@ -175,7 +175,8 @@
             tag_name = 'interface'
         if isinstance(node, (GLibObject, GLibInterface)):
             attrs.append(('glib:type-name', node.type_name))
-            attrs.append(('glib:get-type', node.get_type))
+            if node.get_type:
+                attrs.append(('glib:get-type', node.get_type))
         with self.tagcontext(tag_name, attrs):
             if isinstance(node, Class):
                 for method in node.constructors:

Modified: trunk/giscanner/glibtransformer.py
==============================================================================
--- trunk/giscanner/glibtransformer.py	(original)
+++ trunk/giscanner/glibtransformer.py	Wed Aug 13 21:25:15 2008
@@ -250,6 +250,11 @@
         return True
 
     def _parse_struct(self, struct):
+        # This is a hack, but GObject is a rather fundamental piece so.
+        if (self._namespace_name == 'GObject' and
+            struct.name in ["Object", 'InitiallyUnowned']):
+            self._create_gobject(struct)
+            return
         node = self._output_ns.get(struct.name)
         if node is None:
             self._add_attribute(struct, replace=True)
@@ -314,6 +319,22 @@
         self._add_attribute(node, replace=True)
         self._register_internal_type(type_name, node)
 
+    def _create_gobject(self, node):
+        type_name = 'G' + node.name
+        if type_name == 'GObject':
+            parent_type_name = None
+        else:
+            print 'lookup', type_name
+            type_id = cgobject.type_from_name(type_name)
+            parent_type_name = cgobject.type_name(cgobject.type_parent(type_id))
+            print parent_type_name
+        node = GLibObject(node.name, parent_type_name, type_name, None)
+        type_id = cgobject.TYPE_OBJECT
+        self._introspect_properties(node, type_id)
+        self._introspect_signals(node, type_id)
+        self._add_attribute(node)
+        self._register_internal_type(type_name, node)
+
     def _introspect_object(self, type_id, symbol):
         type_name = cgobject.type_name(type_id)
         parent_type_name = cgobject.type_name(cgobject.type_parent(type_id))



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