Skip to content

Commit

Permalink
[systemd] onUnitNew is triggered with every property check.
Browse files Browse the repository at this point in the history
If the systemd unit doesn't exist, the call systemdServiceIface.getProperty
creates a temporary systemd unit, which triggers onUnitNew.
This results in a loop that causes the issue.

Fixes #439
  • Loading branch information
jmlich committed Jan 14, 2025
1 parent 0bb2e03 commit 0297d86
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions ui/qml/harbour-amazfish.qml
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,9 @@ ApplicationWindowPL
function updateProperties() {
if (ENABLE_SYSTEMD === "YES"){
var activeProperty = systemdServiceIface.getProperty("ActiveState");
if (activeProperty === "active") {
serviceActiveState = true;
} else {
serviceActiveState = false;
}

serviceActiveState = (activeProperty === "active");
var serviceEnabledProperty = systemdServiceIface.getProperty("UnitFileState");
if (serviceEnabledProperty === "enabled") {
serviceEnabledState = true;
}
else {
serviceEnabledState = false;
}
serviceEnabledState = (serviceEnabledProperty === "enabled");
}
}

Expand All @@ -144,13 +134,6 @@ ApplicationWindowPL
iface: "org.freedesktop.systemd1.Manager"
signalsEnabled: true

signal unitNew(string name)
onUnitNew: {
if (name == "harbour-amazfish.service" && ENABLE_SYSTEMD === "YES") {
systemdServiceIface.updateProperties()
}
}

function enableService() {
if(ENABLE_SYSTEMD === "YES") {
systemdManager.typedCall("EnableUnitFiles", [{"type":"as", "value":["harbour-amazfish.service"]}, {"type":"b", "value":false}, {"type":"b", "value":true}])
Expand Down

0 comments on commit 0297d86

Please sign in to comment.