diff options
author | Colin Walters <walters@verbum.org> | 2009-02-19 17:16:17 (GMT) |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2009-03-16 18:05:23 (GMT) |
commit | 6531a094d73703c0c16777bdc82252688d1c7d51 (patch) | |
tree | ddcb4921fc322d27381e90060f2e2776f4dfada7 /giscanner/annotationparser.py | |
parent | 90526643ceb248c56e40f5b6755c3cbb91c3857c (diff) |
Bug 565147 - Add (type) annotation to override the C type definition
We previously supported (type) on signals only, extend it to all cases.
This is useful for a few cases where libraries use a superclass like GtkWidget*
for C convenience, where the actual type is a subclass.
Diffstat (limited to 'giscanner/annotationparser.py')
-rw-r--r-- | giscanner/annotationparser.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/giscanner/annotationparser.py b/giscanner/annotationparser.py index f32486c..e94afa3 100644 --- a/giscanner/annotationparser.py +++ b/giscanner/annotationparser.py @@ -416,6 +416,7 @@ class AnnotationApplier(object): # We're only attempting to name the signal parameters if # the number of parameter tags (@foo) is the same or greater # than the number of signal parameters + resolve = self._transformer.resolve_param_type if block and len(block.tags) > len(signal.parameters): names = block.tags.items() else: @@ -427,7 +428,7 @@ class AnnotationApplier(object): options = getattr(tag, 'options', {}) param_type = options.get(OPT_TYPE) if param_type: - param.type.name = param_type.one() + param.type.name = resolve(param_type.one()) else: tag = None self._parse_param(signal, param, tag) @@ -489,6 +490,10 @@ class AnnotationApplier(object): node.transfer = self._extract_transfer(parent, node, options) if OPT_ALLOW_NONE in options: node.allow_none = True + param_type = options.get(OPT_TYPE) + if param_type: + resolve = self._transformer.resolve_param_type + node.type.name = resolve(param_type.one()) assert node.transfer is not None if tag is not None and tag.comment is not None: |