#include #include #include #include namespace GUI { class NotificationServerConnection : public IPC::ServerConnection , public NotificationClientEndpoint { C_OBJECT(NotificationServerConnection) public: virtual void handshake() override { auto response = send_sync(); set_my_client_id(response->client_id()); } private: NotificationServerConnection() : IPC::ServerConnection(*this, "/tmp/portal/notify") { } virtual void handle(const Messages::NotificationClient::Dummy&) override {} }; Notification::Notification() { } Notification::~Notification() { } static NotificationServerConnection& notification_server_connection() { static NotificationServerConnection* connection; if (!connection) connection = &NotificationServerConnection::construct().leak_ref(); return *connection; } void Notification::show() { notification_server_connection().post_message(Messages::NotificationServer::ShowNotification(m_text, m_title)); } }