Compute prefix by searching through the symbol for bits rather than going
authorColin Walters <walters@verbum.org>
Thu, 21 Aug 2008 20:59:24 +0000 (20:59 +0000)
committerColin Walters <walters@src.gnome.org>
Thu, 21 Aug 2008 20:59:24 +0000 (20:59 +0000)
2008-08-21  Colin Walters  <walters@verbum.org>

* giscanner/glibtransformer.py: Compute prefix
by searching through the symbol for bits
rather than going directly from ctype; this fixes
webkit_ namespace.

svn path=/trunk/; revision=446

ChangeLog
giscanner/glibtransformer.py

index ba2fc57..ca53513 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2008-08-21  Colin Walters  <walters@verbum.org>
 
+       * giscanner/glibtransformer.py: Compute prefix
+       by searching through the symbol for bits
+       rather than going directly from ctype; this fixes
+       webkit_ namespace.
+
+2008-08-21  Colin Walters  <walters@verbum.org>
+
        * giscanner/glibtransformer.py: Also try squashing
        underscores from namespace, fixes webkit_web_view_new.
 
index c0d1875..89a7bc8 100644 (file)
@@ -257,8 +257,13 @@ class GLibTransformer(object):
             # Look at the original C type (before namespace stripping), without
             # pointers: GtkButton -> gtk_button_, so we can figure out the
             # method name
-            orig_type = target_arg.type.ctype.replace('*', '')
-            prefix = to_underscores(orig_type).lower()
+            argtype = target_arg.type.ctype.replace('*', '')
+            name = self._transformer.strip_namespace_object(argtype)
+            name_uscore = to_underscores(name).lower()
+            name_offset = func.symbol.find(name_uscore)
+            if name_offset < 0:
+                return None
+            prefix = func.symbol[:name_offset+len(name_uscore)]
         else:
             # Constructors must have _new
             # Take everything before that as class name