summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--giscanner/glibtransformer.py13
-rw-r--r--giscanner/transformer.py9
3 files changed, 17 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 08b707b0..9136b003 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2008-05-08 Johan Dahlin <johan@gnome.org>
+ * giscanner/glibtransformer.py:
+ * giscanner/transformer.py:
+ Move namespace stripping glibtransformer->transformer
+
+2008-05-08 Johan Dahlin <johan@gnome.org>
+
* giscanner/ast.py:
* giscanner/girwriter.py:
* giscanner/glibtransformer.py:
diff --git a/giscanner/glibtransformer.py b/giscanner/glibtransformer.py
index b7f01f36..977a383a 100644
--- a/giscanner/glibtransformer.py
+++ b/giscanner/glibtransformer.py
@@ -104,14 +104,6 @@ class GLibTransformer(object):
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 @@ class GLibTransformer(object):
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 @@ class GLibTransformer(object):
# 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:
diff --git a/giscanner/transformer.py b/giscanner/transformer.py
index 50165a4e..21c55cc8 100644
--- a/giscanner/transformer.py
+++ b/giscanner/transformer.py
@@ -67,6 +67,14 @@ class Transformer(object):
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 @@ class Transformer(object):
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)