blob: af8d794d83b4977ba177d94f216db87b30947a40 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#include <LibGUI/Notification.h>
#include <LibIPC/ServerConnection.h>
#include <NotificationServer/NotificationClientEndpoint.h>
#include <NotificationServer/NotificationServerEndpoint.h>
namespace GUI {
class NotificationServerConnection : public IPC::ServerConnection<NotificationClientEndpoint, NotificationServerEndpoint>
, public NotificationClientEndpoint {
C_OBJECT(NotificationServerConnection)
public:
virtual void handshake() override
{
auto response = send_sync<Messages::NotificationServer::Greet>();
set_my_client_id(response->client_id());
}
private:
NotificationServerConnection()
: IPC::ServerConnection<NotificationClientEndpoint, NotificationServerEndpoint>(*this, "/tmp/portal/notify")
{
}
virtual void handle(const Messages::NotificationClient::Dummy&) override {}
};
Notification::Notification()
{
}
Notification::~Notification()
{
}
void Notification::show()
{
auto connection = NotificationServerConnection::construct();
connection->post_message(Messages::NotificationServer::ShowNotification(m_text, m_title, m_icon_path));
}
}
|