From c21bc99eeea065acc95b8cb1dfb0290fcb9feaec Mon Sep 17 00:00:00 2001 From: Charlie Brej Date: Tue, 7 Sep 2010 21:23:14 +0100 Subject: [PATCH] boot-client: Add hide-message client command This renames "message" command to "display-message". --- src/client/ply-boot-client.c | 14 +++++++++++++ src/client/ply-boot-client.h | 5 +++++ src/client/plymouth.c | 39 ++++++++++++++++++++++++++++++++---- 3 files changed, 54 insertions(+), 4 deletions(-) diff --git a/src/client/ply-boot-client.c b/src/client/ply-boot-client.c index 48932ac4..48f32583 100644 --- a/src/client/ply-boot-client.c +++ b/src/client/ply-boot-client.c @@ -555,6 +555,20 @@ ply_boot_client_tell_daemon_to_display_message (ply_boot_client_t message, handler, failed_handler, user_data); } +void +ply_boot_client_tell_daemon_to_hide_message (ply_boot_client_t *client, + const char *message, + ply_boot_client_response_handler_t handler, + ply_boot_client_response_handler_t failed_handler, + void *user_data) +{ + assert (client != NULL); + assert (message != NULL); + + ply_boot_client_queue_request (client, PLY_BOOT_PROTOCOL_REQUEST_TYPE_HIDE_MESSAGE, + message, handler, failed_handler, user_data); +} + void ply_boot_client_tell_daemon_system_is_initialized (ply_boot_client_t *client, ply_boot_client_response_handler_t handler, diff --git a/src/client/ply-boot-client.h b/src/client/ply-boot-client.h index 16088761..78fdd214 100644 --- a/src/client/ply-boot-client.h +++ b/src/client/ply-boot-client.h @@ -68,6 +68,11 @@ void ply_boot_client_tell_daemon_to_display_message (ply_boot_client_t ply_boot_client_response_handler_t handler, ply_boot_client_response_handler_t failed_handler, void *user_data); +void ply_boot_client_tell_daemon_to_hide_message (ply_boot_client_t *client, + const char *message, + ply_boot_client_response_handler_t handler, + ply_boot_client_response_handler_t failed_handler, + void *user_data); void ply_boot_client_ask_daemon_for_password (ply_boot_client_t *client, const char *prompt, ply_boot_client_answer_handler_t handler, diff --git a/src/client/plymouth.c b/src/client/plymouth.c index 552c36a6..ffde1326 100644 --- a/src/client/plymouth.c +++ b/src/client/plymouth.c @@ -585,8 +585,8 @@ on_question_request (state_t *state, } static void -on_message_request (state_t *state, - const char *command) +on_display_message_request (state_t *state, + const char *command) { char *text; @@ -607,6 +607,29 @@ on_message_request (state_t *state, } } +static void +on_hide_message_request (state_t *state, + const char *command) +{ + char *text; + + text = NULL; + ply_command_parser_get_command_options (state->command_parser, + command, + "text", &text, + NULL); + if (text != NULL) + { + ply_boot_client_tell_daemon_to_hide_message (state->client, + text, + (ply_boot_client_response_handler_t) + on_success, + (ply_boot_client_response_handler_t) + on_failure, state); + free (text); + } +} + static void on_keystroke_request (state_t *state, const char *command) @@ -936,9 +959,17 @@ main (int argc, NULL); ply_command_parser_add_command (state.command_parser, - "message", "Display a message", + "display-message", "Display a message", + (ply_command_handler_t) + on_display_message_request, &state, + "text", "The message text", + PLY_COMMAND_OPTION_TYPE_STRING, + NULL); + + ply_command_parser_add_command (state.command_parser, + "hide-message", "Hide a message", (ply_command_handler_t) - on_message_request, &state, + on_hide_message_request, &state, "text", "The message text", PLY_COMMAND_OPTION_TYPE_STRING, NULL); -- 2.47.3