1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-02 23:32:06 +00:00

LibGUI+Notification: Use lifetime connection

In order to allow notifications to be updated, we will create a persistent connection for the lifetime of the notification.
This commit is contained in:
Nick Johnson 2021-03-11 13:37:26 -06:00 committed by Andreas Kling
parent dddaa529b2
commit 7351c77a42
2 changed files with 5 additions and 2 deletions

View file

@ -49,6 +49,7 @@ private:
};
Notification::Notification()
: m_connection(NotificationServerConnection::construct())
{
}
@ -58,9 +59,8 @@ Notification::~Notification()
void Notification::show()
{
auto connection = NotificationServerConnection::construct();
auto icon = m_icon ? m_icon->to_shareable_bitmap() : Gfx::ShareableBitmap();
connection->send_sync<Messages::NotificationServer::ShowNotification>(m_text, m_title, icon);
m_connection->send_sync<Messages::NotificationServer::ShowNotification>(m_text, m_title, icon);
}
}