refact: change implementation of UpdateApplicationInfo

adjust the way of get XDG_DATA_DIRS.

Signed-off-by: ComixHe <heyuming@deepin.org>
Signed-off-by: black-desk <me@black-desk.cn>
This commit is contained in:
ComixHe
2023-08-11 17:46:46 +08:00
committed by Comix
parent 5183716873
commit 2fa74e40e5
10 changed files with 179 additions and 169 deletions

View File

@ -33,18 +33,20 @@ bool SystemdSignalDispatcher::connectToSignals() noexcept
void SystemdSignalDispatcher::onUnitNew(QString unitName, QDBusObjectPath systemdUnitPath)
{
if (!unitName.startsWith("app-")) {
constexpr decltype(auto) appPrefix = u8"app-";
if (!unitName.startsWith(appPrefix)) {
return;
}
emit SystemdUnitNew(unitName.sliced(sizeof("app-") - 1), systemdUnitPath);
emit SystemdUnitNew(unitName.sliced(sizeof(appPrefix) - 1), systemdUnitPath);
}
void SystemdSignalDispatcher::onUnitRemoved(QString unitName, QDBusObjectPath systemdUnitPath)
{
if (!unitName.startsWith("app-")) {
constexpr decltype(auto) appPrefix = u8"app-";
if (!unitName.startsWith(appPrefix)) {
return;
}
emit SystemdUnitRemoved(unitName.sliced(sizeof("app-") - 1), systemdUnitPath);
emit SystemdUnitRemoved(unitName.sliced(sizeof(appPrefix) - 1), systemdUnitPath);
}