diff options
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibGUI/Notification.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/Notification.h | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/Userland/Libraries/LibGUI/Notification.cpp b/Userland/Libraries/LibGUI/Notification.cpp index 51667d6a97..34e06345c9 100644 --- a/Userland/Libraries/LibGUI/Notification.cpp +++ b/Userland/Libraries/LibGUI/Notification.cpp @@ -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); } } diff --git a/Userland/Libraries/LibGUI/Notification.h b/Userland/Libraries/LibGUI/Notification.h index 1b86bc8199..b26c5aa0fa 100644 --- a/Userland/Libraries/LibGUI/Notification.h +++ b/Userland/Libraries/LibGUI/Notification.h @@ -30,6 +30,7 @@ #include <LibGfx/Bitmap.h> namespace GUI { + class NotificationServerConnection; class Notification : public Core::Object { C_OBJECT(Notification); @@ -54,6 +55,8 @@ private: String m_title; String m_text; RefPtr<Gfx::Bitmap> m_icon; + + NonnullRefPtr<NotificationServerConnection> m_connection; }; } |