plugins/nightcolor: Register its own service name

In order to make monitoring Night Color appearing and disappearing robust,
make Night Color register its own dbus service.

CCBUG: 428854
This commit is contained in:
Vlad Zahorodnii 2022-12-01 09:56:15 +00:00
parent a6a022f00f
commit 8d04733682
2 changed files with 7 additions and 1 deletions

View file

@ -174,6 +174,12 @@ NightColorDBusInterface::NightColorDBusInterface(NightColorManager *parent)
new ColorCorrectAdaptor(this);
QDBusConnection::sessionBus().registerObject(QStringLiteral("/ColorCorrect"), this);
QDBusConnection::sessionBus().registerService(QStringLiteral("org.kde.NightColor"));
}
NightColorDBusInterface::~NightColorDBusInterface()
{
QDBusConnection::sessionBus().unregisterService(QStringLiteral("org.kde.NightColor"));
}
bool NightColorDBusInterface::isInhibited() const

View file

@ -35,7 +35,7 @@ class NightColorDBusInterface : public QObject, public QDBusContext
public:
explicit NightColorDBusInterface(NightColorManager *parent);
~NightColorDBusInterface() override = default;
~NightColorDBusInterface() override;
bool isInhibited() const;
bool isEnabled() const;