Do not call CloseNotification for activatable services

If the notification daemon is an activatable GApplication service (e.g.
on Mate), then the notification daemon may terminate a short time after
the notification has vanished (usually 15s). In that case the
notification daemon may reuse notification IDs, which is incompatible
with our notification clearing.
Also the service may not be running at all, when we call the
CloseNotification endpoint.

To fix this, we simply disable the entire notification history clearing
functionality on such desktops by proactively clearing all notification
references from our internal notification manager.

Signed-off-by: Magnus Groß <magnus.gross@rwth-aachen.de>
This commit is contained in:
Ilya Fedin 2022-02-28 22:52:51 +01:00 committed by John Preston
parent 4dd14b81e1
commit b39e4a3138

View file

@ -74,6 +74,9 @@ std::unique_ptr<base::Platform::DBus::ServiceWatcher> CreateServiceWatcher() {
const Glib::ustring &oldOwner,
const Glib::ustring &newOwner) {
if (activatable && newOwner.empty()) {
crl::on_main([] {
Core::App().notifications().clearAll();
});
return;
}
@ -665,7 +668,9 @@ void NotificationData::close() {
_notificationId,
}),
{},
std::string(kService));
std::string(kService),
-1,
Gio::DBus::CALL_FLAGS_NO_AUTO_START);
_manager->clearNotification(_id);
}