Don't subscribe to inhibiton changes when not supported

This commit is contained in:
Ilya Fedin 2022-11-12 06:32:43 +04:00 committed by John Preston
parent f9dd2b4a0a
commit b4d310fd1e

View file

@ -258,11 +258,6 @@ void GetCapabilities(Fn<void(const QStringList &)> callback) {
} }
void GetInhibited(Fn<void(bool)> callback) { void GetInhibited(Fn<void(bool)> callback) {
if (!CurrentCapabilities.contains(qsl("inhibitions"))) {
crl::on_main([=] { callback(false); });
return;
}
Noexcept([&] { Noexcept([&] {
const auto connection = Gio::DBus::Connection::get_sync( const auto connection = Gio::DBus::Connection::get_sync(
Gio::DBus::BusType::SESSION); Gio::DBus::BusType::SESSION);
@ -947,6 +942,7 @@ Manager::Private::Private(not_null<Manager*> manager, Type type)
.arg(capabilities.join(", "))); .arg(capabilities.join(", ")));
} }
if (capabilities.contains(qsl("inhibitions"))) {
Noexcept([&] { Noexcept([&] {
_dbusConnection = Gio::DBus::Connection::get_sync( _dbusConnection = Gio::DBus::Connection::get_sync(
Gio::DBus::BusType::SESSION); Gio::DBus::BusType::SESSION);
@ -991,6 +987,7 @@ Manager::Private::Private(not_null<Manager*> manager, Type type)
std::string(kPropertiesInterface), std::string(kPropertiesInterface),
"PropertiesChanged", "PropertiesChanged",
std::string(kObjectPath)); std::string(kObjectPath));
}
} }
void Manager::Private::showNotification( void Manager::Private::showNotification(