There's some code duplication with two implementations of org.freedesktop.systemd1.Manager.GetUnitFileState - this could be shared in a function.
The two services are checked in series, which makes the callback logic somewhat complicated. You should probably check both services in parallel, and only call set_switch_state when the second result is returned.
Some general comments on the patch:
There's some code duplication with two implementations of org.freedesktop .systemd1. Manager. GetUnitFileStat e - this could be shared in a function.
The two services are checked in series, which makes the callback logic somewhat complicated. You should probably check both services in parallel, and only call set_switch_state when the second result is returned.