mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-10-30 21:01:00 +00:00 
			
		
		
		
	 faedb763ca
			
		
	
	
		faedb763ca
		
	
	
	
	
		
			
			We currently use icon paths for this because I didn't want to deal with implementing icon bitmap sharing right now. In the future it would be better to post a bitmap somehow instead of a path.
		
			
				
	
	
		
			41 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| #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));
 | |
| }
 | |
| 
 | |
| }
 |