refact: apply review suggestions

Signed-off-by: black-desk <me@black-desk.cn>
This commit is contained in:
black-desk
2023-08-11 14:53:05 +08:00
committed by Comix
parent 4394edd8b8
commit 5183716873
10 changed files with 49 additions and 53 deletions

View File

@ -31,20 +31,20 @@ bool SystemdSignalDispatcher::connectToSignals() noexcept
return true;
}
void SystemdSignalDispatcher::onUnitNew(QString serviceName, QDBusObjectPath systemdUnitPath)
void SystemdSignalDispatcher::onUnitNew(QString unitName, QDBusObjectPath systemdUnitPath)
{
if (!serviceName.startsWith("app-")) {
if (!unitName.startsWith("app-")) {
return;
}
emit SystemdUnitNew(serviceName.sliced(4), systemdUnitPath); // remove "app-"
emit SystemdUnitNew(unitName.sliced(sizeof("app-") - 1), systemdUnitPath);
}
void SystemdSignalDispatcher::onUnitRemoved(QString serviceName, QDBusObjectPath systemdUnitPath)
void SystemdSignalDispatcher::onUnitRemoved(QString unitName, QDBusObjectPath systemdUnitPath)
{
if (!serviceName.startsWith("app-")) {
if (!unitName.startsWith("app-")) {
return;
}
emit SystemdUnitRemoved(serviceName.sliced(4), systemdUnitPath);
emit SystemdUnitRemoved(unitName.sliced(sizeof("app-") - 1), systemdUnitPath);
}