Change sync-create to no-sync-create

Fixes #31
This commit is contained in:
James Westman 2022-01-26 23:30:19 -06:00
parent 3bdcc83c4e
commit 32d4769f65
4 changed files with 14 additions and 13 deletions

View file

@ -249,9 +249,9 @@ def decompile_property(ctx, gir, name, cdata, bind_source=None, bind_property=No
ctx.end_block_with(";") ctx.end_block_with(";")
elif bind_source: elif bind_source:
flags = "" flags = ""
if bind_flags: bind_flags = bind_flags or []
if "sync-create" in bind_flags: if "sync-create" not in bind_flags:
flags += " sync-create" flags += " no-sync-create"
if "invert-boolean" in bind_flags: if "invert-boolean" in bind_flags:
flags += " inverted" flags += " inverted"
if "bidirectional" in bind_flags: if "bidirectional" in bind_flags:

View file

@ -34,7 +34,8 @@ class Property(AstNode):
".", ".",
UseIdent("bind_property").expected("a property name to bind from"), UseIdent("bind_property").expected("a property name to bind from"),
ZeroOrMore(AnyOf( ZeroOrMore(AnyOf(
["sync-create", UseLiteral("sync_create", True)], "sync-create",
["no-sync-create", UseLiteral("no_sync_create", True)],
["inverted", UseLiteral("inverted", True)], ["inverted", UseLiteral("inverted", True)],
["bidirectional", UseLiteral("bidirectional", True)], ["bidirectional", UseLiteral("bidirectional", True)],
)), )),
@ -109,7 +110,7 @@ class Property(AstNode):
value = values[0] if len(values) == 1 else None value = values[0] if len(values) == 1 else None
bind_flags = [] bind_flags = []
if self.tokens["sync_create"]: if self.tokens["bind_source"] and not self.tokens["no_sync_create"]:
bind_flags.append("sync-create") bind_flags.append("sync-create")
if self.tokens["inverted"]: if self.tokens["inverted"]:
bind_flags.append("invert-boolean") bind_flags.append("invert-boolean")

View file

@ -3,7 +3,7 @@ using Gtk 4.0;
Box { Box {
visible: bind box2.visible inverted; visible: bind box2.visible inverted;
orientation: bind box2.orientation; orientation: bind box2.orientation;
spacing: bind box2.spacing sync-create; spacing: bind box2.spacing no-sync-create;
} }
Box box2 { Box box2 {

View file

@ -2,9 +2,9 @@
<interface> <interface>
<requires lib="gtk" version="4.0"/> <requires lib="gtk" version="4.0"/>
<object class="GtkBox"> <object class="GtkBox">
<property name="visible" bind-source="box2" bind-property="visible" bind-flags="invert-boolean"/> <property name="visible" bind-source="box2" bind-property="visible" bind-flags="sync-create|invert-boolean"/>
<property name="orientation" bind-source="box2" bind-property="orientation"/> <property name="orientation" bind-source="box2" bind-property="orientation" bind-flags="sync-create"/>
<property name="spacing" bind-source="box2" bind-property="spacing" bind-flags="sync-create"/> <property name="spacing" bind-source="box2" bind-property="spacing"/>
</object> </object>
<object class="GtkBox" id="box2"> <object class="GtkBox" id="box2">
<property name="spacing">6</property> <property name="spacing">6</property>