Add bind for bidirectional

This commit is contained in:
Tijder 2021-12-14 19:59:09 +00:00
parent 6800601d94
commit 168b87bb4a
3 changed files with 5 additions and 0 deletions

View file

@ -281,6 +281,8 @@ class Property(AstNode):
bind_flags.append("sync-create")
if self.tokens["after"]:
bind_flags.append("after")
if self.tokens["bidirectional"]:
bind_flags.append("bidirectional")
bind_flags_str = "|".join(bind_flags) or None
props = {

View file

@ -283,6 +283,8 @@ def decompile_property(ctx, gir, name, cdata, bind_source=None, bind_property=No
flags += " sync-create"
if "after" in bind_flags:
flags += " after"
if "bidirectional" in bind_flags:
flags += " bidirectional"
ctx.print(f"{name}: bind {bind_source}.{bind_property}{flags};")
elif _truthy(translatable):
if context is not None:

View file

@ -77,6 +77,7 @@ def parse(tokens) -> T.Tuple[ast.UI, T.Optional[MultipleErrors]]:
ZeroOrMore(AnyOf(
Sequence(Keyword("sync-create"), UseLiteral("sync_create", True)),
Sequence(Keyword("after"), UseLiteral("after", True)),
Sequence(Keyword("bidirectional"), UseLiteral("bidirectional", True)),
)),
)
)