1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:38:10 +00:00

LibGUI+Notification: Add mutable notifications

This commit puts all of the remaining pieces in place. This adds a
mechanism to update the text, title, and icon of an image. If an image
is not provided, the default ladybug will be shown.
This commit is contained in:
Nick Johnson 2021-03-11 15:43:01 -06:00 committed by Andreas Kling
parent 147a2c4ca2
commit 8f6894d250
7 changed files with 119 additions and 7 deletions

View file

@ -69,4 +69,29 @@ OwnPtr<Messages::NotificationServer::CloseNotificationResponse> ClientConnection
return make<Messages::NotificationServer::CloseNotificationResponse>();
}
OwnPtr<Messages::NotificationServer::UpdateNotificationIconResponse> ClientConnection::handle(const Messages::NotificationServer::UpdateNotificationIcon& message)
{
auto window = NotificationWindow::get_window_by_id(client_id());
if (window) {
window->set_image(message.icon());
}
return make<Messages::NotificationServer::UpdateNotificationIconResponse>(window);
}
OwnPtr<Messages::NotificationServer::UpdateNotificationTextResponse> ClientConnection::handle(const Messages::NotificationServer::UpdateNotificationText& message)
{
auto window = NotificationWindow::get_window_by_id(client_id());
if (window) {
window->set_text(message.text());
window->set_title(message.title());
}
return make<Messages::NotificationServer::UpdateNotificationTextResponse>(window);
}
OwnPtr<Messages::NotificationServer::IsShowingResponse> ClientConnection::handle(const Messages::NotificationServer::IsShowing&)
{
auto window = NotificationWindow::get_window_by_id(client_id());
return make<Messages::NotificationServer::IsShowingResponse>(window);
}
}