diff options
Diffstat (limited to 'giscanner')
-rw-r--r-- | giscanner/annotationparser.py | 4 | ||||
-rw-r--r-- | giscanner/maintransformer.py | 13 |
2 files changed, 13 insertions, 4 deletions
diff --git a/giscanner/annotationparser.py b/giscanner/annotationparser.py index 243b6afd..e0a7cec6 100644 --- a/giscanner/annotationparser.py +++ b/giscanner/annotationparser.py @@ -111,6 +111,7 @@ OPT_SCOPE_NOTIFIED = 'notified' OPT_TRANSFER_NONE = 'none' OPT_TRANSFER_CONTAINER = 'container' OPT_TRANSFER_FULL = 'full' +OPT_TRANSFER_FLOATING = 'floating' class DocBlock(object): @@ -346,7 +347,8 @@ class DocTag(object): n_params=1, choices=[OPT_TRANSFER_FULL, OPT_TRANSFER_CONTAINER, - OPT_TRANSFER_NONE]) + OPT_TRANSFER_NONE, + OPT_TRANSFER_FLOATING]) elif option == OPT_TYPE: self._validate_option('type', value, required=True, n_params=1) diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py index 5b1ffb79..73586004 100644 --- a/giscanner/maintransformer.py +++ b/giscanner/maintransformer.py @@ -32,7 +32,8 @@ from .annotationparser import (OPT_ALLOW_NONE, OPT_ARRAY, OPT_ATTRIBUTE, OPT_TYPE, OPT_CLOSURE, OPT_DESTROY, OPT_TRANSFER, OPT_SKIP, OPT_FOREIGN, OPT_ARRAY_FIXED_SIZE, OPT_ARRAY_LENGTH, OPT_ARRAY_ZERO_TERMINATED, - OPT_CONSTRUCTOR, OPT_METHOD) + OPT_CONSTRUCTOR, OPT_METHOD, + OPT_TRANSFER_NONE, OPT_TRANSFER_FLOATING) from .annotationparser import AnnotationParser from .transformer import TransformerException from .utils import to_underscores, to_underscores_noprefix @@ -569,7 +570,10 @@ usage is void (*_gtk_reserved1)(void);""" transfer_tag = options.get(OPT_TRANSFER) if transfer_tag and transfer_tag.length() == 1: - node.transfer = transfer_tag.one() + transfer = transfer_tag.one() + if transfer == OPT_TRANSFER_FLOATING: + transfer = OPT_TRANSFER_NONE + node.transfer = transfer self._adjust_container_type(parent, node, options) @@ -755,7 +759,10 @@ usage is void (*_gtk_reserved1)(void);""" return transfer_tag = block.get(OPT_TRANSFER) if transfer_tag is not None: - prop.transfer = transfer_tag.value + transfer = transfer_tag.value + if transfer == OPT_TRANSFER_FLOATING: + transfer = OPT_TRANSFER_NONE + prop.transfer = transfer else: prop.transfer = self._get_transfer_default(parent, prop) type_tag = block.get(TAG_TYPE) |