1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:58:11 +00:00

Userland: Get rid of the OwnPtr<...> boilerplate code for IPC handlers

This commit is contained in:
Gunnar Beutner 2021-05-02 04:39:36 +02:00 committed by Andreas Kling
parent 1a015dc379
commit 7cf2839a26
33 changed files with 389 additions and 385 deletions

View file

@ -28,50 +28,50 @@ void ClientConnection::die()
s_connections.remove(client_id());
}
OwnPtr<Messages::NotificationServer::GreetResponse> ClientConnection::handle(const Messages::NotificationServer::Greet&)
Messages::NotificationServer::GreetResponse ClientConnection::handle(const Messages::NotificationServer::Greet&)
{
return make<Messages::NotificationServer::GreetResponse>();
return {};
}
OwnPtr<Messages::NotificationServer::ShowNotificationResponse> ClientConnection::handle(const Messages::NotificationServer::ShowNotification& message)
Messages::NotificationServer::ShowNotificationResponse ClientConnection::handle(const Messages::NotificationServer::ShowNotification& message)
{
auto window = NotificationWindow::construct(client_id(), message.text(), message.title(), message.icon());
window->show();
return make<Messages::NotificationServer::ShowNotificationResponse>();
return {};
}
OwnPtr<Messages::NotificationServer::CloseNotificationResponse> ClientConnection::handle([[maybe_unused]] const Messages::NotificationServer::CloseNotification& message)
Messages::NotificationServer::CloseNotificationResponse ClientConnection::handle([[maybe_unused]] const Messages::NotificationServer::CloseNotification& message)
{
auto window = NotificationWindow::get_window_by_id(client_id());
if (window) {
window->close();
}
return make<Messages::NotificationServer::CloseNotificationResponse>();
return {};
}
OwnPtr<Messages::NotificationServer::UpdateNotificationIconResponse> ClientConnection::handle(const Messages::NotificationServer::UpdateNotificationIcon& message)
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);
return !!window;
}
OwnPtr<Messages::NotificationServer::UpdateNotificationTextResponse> ClientConnection::handle(const Messages::NotificationServer::UpdateNotificationText& message)
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);
return !!window;
}
OwnPtr<Messages::NotificationServer::IsShowingResponse> ClientConnection::handle(const Messages::NotificationServer::IsShowing&)
Messages::NotificationServer::IsShowingResponse ClientConnection::handle(const Messages::NotificationServer::IsShowing&)
{
auto window = NotificationWindow::get_window_by_id(client_id());
return make<Messages::NotificationServer::IsShowingResponse>(window);
return !!window;
}
}