gobject-introspection r272 - in trunk: . giscanner



Author: johan
Date: Fri May  9 00:43:21 2008
New Revision: 272
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=272&view=rev

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

        * giscanner/glibtransformer.py:
        * giscanner/transformer.py:
        Move namespace stripping glibtransformer->transformer



Modified:
   trunk/ChangeLog
   trunk/giscanner/glibtransformer.py
   trunk/giscanner/transformer.py

Modified: trunk/giscanner/glibtransformer.py
==============================================================================
--- trunk/giscanner/glibtransformer.py	(original)
+++ trunk/giscanner/glibtransformer.py	Fri May  9 00:43:21 2008
@@ -104,14 +104,6 @@
     def _register_internal_type(self, type_name, node):
         self._type_names[type_name] = (None, node)
 
-    def _strip_namespace_func(self, name):
-        orig_name = name
-        prefix = self._namespace_name.lower() + '_'
-        name = name.lower()
-        if name.startswith(prefix):
-            name = orig_name[len(prefix):]
-        return name
-
     def _strip_namespace_object(self, name):
         orig_name = name
         prefix = self._namespace_name.lower()
@@ -160,7 +152,6 @@
 
         self._parse_parameters(func.parameters)
 
-        func.name = self._strip_namespace_func(func.name)
         self._add_attribute(func)
 
     def _parse_parameters(self, parameters):
@@ -221,11 +212,11 @@
 
         # GtkButton -> gtk_button_, so we can figure out the method name
         prefix = to_underscores(orig_name).lower() + '_'
-        if not func.name.startswith(prefix):
+        if not func.symbol.startswith(prefix):
             return False
 
         # Strip namespace and object prefix: gtk_window_new -> new
-        func.name = func.name[len(prefix):]
+        func.name = func.symbol[len(prefix):]
         if is_method:
             class_.methods.append(func)
         else:

Modified: trunk/giscanner/transformer.py
==============================================================================
--- trunk/giscanner/transformer.py	(original)
+++ trunk/giscanner/transformer.py	Fri May  9 00:43:21 2008
@@ -67,6 +67,14 @@
         for node in parser.get_nodes():
             self._type_names[node.type_name] = (nsname, node)
 
+    def _strip_namespace_func(self, name):
+        orig_name = name
+        prefix = self._namespace.name.lower() + '_'
+        name = name.lower()
+        if name.startswith(prefix):
+            name = orig_name[len(prefix):]
+        return name
+
     def _remove_prefix(self, name):
         # when --strip-prefix=g:
         #   GHashTable -> HashTable
@@ -129,6 +137,7 @@
         return_ = self._create_return(symbol.base_type.base_type,
                                       directives.get('return', []))
         name = self._remove_prefix(symbol.ident)
+        name = self._strip_namespace_func(name)
 
         return Function(name, return_, parameters, symbol.ident)
 



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