[aurorae] Use property binding for toggled state

So far we manually updated the toggled state depending on the button
type and the corresponding client property. This had an error sneaked
in for onAllDesktops: it was bound to desktop change instead of on all
desktop change causing the button to not reflect the state correctly.

To prevent such errors it's now setup to a property binding to the
client's state directly.

BUG: 354702
FIXED-IN: 5.4.3
REVIEW: 125917
This commit is contained in:
Martin Gräßlin 2015-11-02 10:08:07 +01:00
parent 7c3e4afe54
commit e6542f01d3

View file

@ -107,45 +107,18 @@ Item {
switch (button.buttonType) {
case DecorationOptions.DecorationButtonOnAllDesktops:
// all desktops
button.toggled = decoration.client.onAllDesktops;
button.toggled = Qt.binding(function() { return decoration.client.onAllDesktops; });
break;
case DecorationOptions.DecorationButtonKeepAbove:
button.toggled = decoration.client.keepAbove;
button.toggled = Qt.binding(function() { return decoration.client.keepAbove; });
break;
case DecorationOptions.DecorationButtonKeepBelow:
button.toggled = decoration.client.keepBelow;
button.toggled = Qt.binding(function() { return decoration.client.keepBelow; });
break;
case DecorationOptions.DecorationButtonShade:
button.toggled = decoration.client.shaded;
button.toggled = Qt.binding(function() { return decoration.client.shaded; });
break;
}
}
Connections {
target: decoration.client
onShadedChanged: {
if (button.buttonType != DecorationOptions.DecorationButtonShade) {
return;
}
button.toggled = decoration.client.shaded;
}
onKeepBelowChanged: {
if (button.buttonType != DecorationOptions.DecorationButtonKeepBelow) {
return;
}
button.toggled = decoration.client.keepBelow;
}
onKeepAboveChanged: {
if (button.buttonType != DecorationOptions.DecorationButtonKeepAbove) {
return;
}
button.toggled = decoration.client.keepAbove;
}
onDesktopChanged: {
if (button.buttonType != DecorationOptions.DecorationButtonOnAllDesktops) {
return;
}
button.toggled = decoration.client.onAllDesktops;
}
}
}
}