boot-client: Add hide-message client command

This renames "message" command to "display-message".
This commit is contained in:
Charlie Brej 2010-09-07 21:23:14 +01:00
parent 1244d41fdd
commit c21bc99eee
3 changed files with 54 additions and 4 deletions

View file

@ -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,

View file

@ -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,

View file

@ -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_message_request, &state,
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_hide_message_request, &state,
"text", "The message text",
PLY_COMMAND_OPTION_TYPE_STRING,
NULL);