mirror of
https://gitlab.freedesktop.org/plymouth/plymouth.git
synced 2026-05-07 10:48:09 +02:00
Merge branch 'valentindavid/reload-command' into 'main'
main: Add "reload" command See merge request plymouth/plymouth!194
This commit is contained in:
commit
214cdfc8c8
7 changed files with 83 additions and 0 deletions
|
|
@ -728,6 +728,18 @@ ply_boot_client_tell_daemon_to_quit (ply_boot_client_t *client,
|
|||
arg, handler, failed_handler, user_data);
|
||||
}
|
||||
|
||||
void
|
||||
ply_boot_client_tell_daemon_to_reload (ply_boot_client_t *client,
|
||||
ply_boot_client_response_handler_t handler,
|
||||
ply_boot_client_response_handler_t failed_handler,
|
||||
void *user_data)
|
||||
{
|
||||
assert (client != NULL);
|
||||
|
||||
ply_boot_client_queue_request (client, PLY_BOOT_PROTOCOL_REQUEST_TYPE_RELOAD,
|
||||
NULL, handler, failed_handler, user_data);
|
||||
}
|
||||
|
||||
void
|
||||
ply_boot_client_tell_daemon_to_progress_pause (ply_boot_client_t *client,
|
||||
ply_boot_client_response_handler_t handler,
|
||||
|
|
|
|||
|
|
@ -132,6 +132,10 @@ void ply_boot_client_tell_daemon_to_quit (ply_boot_client_t *cli
|
|||
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_reload (ply_boot_client_t *client,
|
||||
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_progress_pause (ply_boot_client_t *client,
|
||||
ply_boot_client_response_handler_t handler,
|
||||
ply_boot_client_response_handler_t failed_handler,
|
||||
|
|
|
|||
|
|
@ -716,6 +716,17 @@ on_quit_request (state_t *state,
|
|||
on_failure, state);
|
||||
}
|
||||
|
||||
static void
|
||||
on_reload_request (state_t *state,
|
||||
const char *command)
|
||||
{
|
||||
ply_boot_client_tell_daemon_to_reload (state->client,
|
||||
(ply_boot_client_response_handler_t)
|
||||
on_success,
|
||||
(ply_boot_client_response_handler_t)
|
||||
on_failure, state);
|
||||
}
|
||||
|
||||
static void
|
||||
on_update_root_fs_request (state_t *state,
|
||||
const char *command)
|
||||
|
|
@ -1057,6 +1068,11 @@ main (int argc,
|
|||
"retain-splash", "Don't explicitly hide boot splash on exit",
|
||||
PLY_COMMAND_OPTION_TYPE_FLAG, NULL);
|
||||
|
||||
ply_command_parser_add_command (state.command_parser,
|
||||
"reload", "Tell the daemon to reload the theme",
|
||||
(ply_command_handler_t)
|
||||
on_reload_request, &state, NULL);
|
||||
|
||||
if (!ply_command_parser_parse_arguments (state.command_parser, state.loop, argv, argc)) {
|
||||
char *help_string;
|
||||
|
||||
|
|
|
|||
40
src/main.c
40
src/main.c
|
|
@ -911,6 +911,45 @@ plymouth_should_show_default_splash (state_t *state)
|
|||
return false;
|
||||
}
|
||||
|
||||
static void
|
||||
on_reload (state_t *state)
|
||||
{
|
||||
ply_trace ("reloading");
|
||||
if (state->boot_splash != NULL) {
|
||||
ply_boot_splash_hide (state->boot_splash);
|
||||
ply_boot_splash_free (state->boot_splash);
|
||||
state->boot_splash = NULL;
|
||||
}
|
||||
|
||||
free (state->override_splash_path);
|
||||
state->override_splash_path = NULL;
|
||||
free (state->system_default_splash_path);
|
||||
state->system_default_splash_path = NULL;
|
||||
free (state->distribution_default_splash_path);
|
||||
state->distribution_default_splash_path = NULL;
|
||||
|
||||
find_override_splash (state);
|
||||
find_system_default_splash (state);
|
||||
find_distribution_default_splash (state);
|
||||
|
||||
if (state->is_inactive) {
|
||||
ply_trace ("reload while inactive");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!state->is_shown) {
|
||||
ply_trace ("reload while not shown");
|
||||
return;
|
||||
}
|
||||
|
||||
if (state->showing_details) {
|
||||
show_detailed_splash (state);
|
||||
} else {
|
||||
show_default_splash (state);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
on_show_splash (state_t *state)
|
||||
{
|
||||
|
|
@ -1430,6 +1469,7 @@ start_boot_server (state_t *state)
|
|||
(ply_boot_server_reactivate_handler_t) on_reactivate,
|
||||
(ply_boot_server_quit_handler_t) on_quit,
|
||||
(ply_boot_server_has_active_vt_handler_t) on_has_active_vt,
|
||||
(ply_boot_server_reload_handler_t) on_reload,
|
||||
state);
|
||||
|
||||
if (!ply_boot_server_listen (server)) {
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
#define PLY_BOOT_PROTOCOL_REQUEST_TYPE_DEACTIVATE "D"
|
||||
#define PLY_BOOT_PROTOCOL_REQUEST_TYPE_REACTIVATE "r"
|
||||
#define PLY_BOOT_PROTOCOL_REQUEST_TYPE_QUIT "Q"
|
||||
#define PLY_BOOT_PROTOCOL_REQUEST_TYPE_RELOAD "l"
|
||||
#define PLY_BOOT_PROTOCOL_REQUEST_TYPE_PASSWORD "*"
|
||||
#define PLY_BOOT_PROTOCOL_REQUEST_TYPE_CACHED_PASSWORD "c"
|
||||
#define PLY_BOOT_PROTOCOL_REQUEST_TYPE_QUESTION "W"
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ struct _ply_boot_server
|
|||
ply_boot_server_reactivate_handler_t reactivate_handler;
|
||||
ply_boot_server_quit_handler_t quit_handler;
|
||||
ply_boot_server_has_active_vt_handler_t has_active_vt_handler;
|
||||
ply_boot_server_reload_handler_t reload_handler;
|
||||
void *user_data;
|
||||
|
||||
uint32_t is_listening : 1;
|
||||
|
|
@ -106,6 +107,7 @@ ply_boot_server_new (ply_boot_server_update_handler_t update_handle
|
|||
ply_boot_server_reactivate_handler_t reactivate_handler,
|
||||
ply_boot_server_quit_handler_t quit_handler,
|
||||
ply_boot_server_has_active_vt_handler_t has_active_vt_handler,
|
||||
ply_boot_server_reload_handler_t reload_handler,
|
||||
void *user_data)
|
||||
{
|
||||
ply_boot_server_t *server;
|
||||
|
|
@ -135,6 +137,7 @@ ply_boot_server_new (ply_boot_server_update_handler_t update_handle
|
|||
server->reactivate_handler = reactivate_handler;
|
||||
server->quit_handler = quit_handler;
|
||||
server->has_active_vt_handler = has_active_vt_handler;
|
||||
server->reload_handler = reload_handler;
|
||||
server->user_data = user_data;
|
||||
|
||||
return server;
|
||||
|
|
@ -545,6 +548,10 @@ ply_boot_connection_on_request (ply_boot_connection_t *connection)
|
|||
free (argument);
|
||||
free (command);
|
||||
return;
|
||||
} else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_RELOAD) == 0) {
|
||||
ply_trace ("got reload request");
|
||||
if (server->reload_handler != NULL)
|
||||
server->reload_handler (server->user_data, server);
|
||||
} else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_PASSWORD) == 0) {
|
||||
ply_trigger_t *answer;
|
||||
|
||||
|
|
|
|||
|
|
@ -102,6 +102,8 @@ typedef void (*ply_boot_server_quit_handler_t) (void *user_data,
|
|||
ply_boot_server_t *server);
|
||||
typedef bool (*ply_boot_server_has_active_vt_handler_t) (void *user_data,
|
||||
ply_boot_server_t *server);
|
||||
typedef bool (*ply_boot_server_reload_handler_t) (void *user_data,
|
||||
ply_boot_server_t *server);
|
||||
|
||||
#ifndef PLY_HIDE_FUNCTION_DECLARATIONS
|
||||
ply_boot_server_t *ply_boot_server_new (ply_boot_server_update_handler_t update_handler,
|
||||
|
|
@ -124,6 +126,7 @@ ply_boot_server_t *ply_boot_server_new (ply_boot_server_update_handler_t
|
|||
ply_boot_server_reactivate_handler_t reactivate_handler,
|
||||
ply_boot_server_quit_handler_t quit_handler,
|
||||
ply_boot_server_has_active_vt_handler_t has_active_vt_handler,
|
||||
ply_boot_server_reload_handler_t reload_handler,
|
||||
void *user_data);
|
||||
|
||||
void ply_boot_server_free (ply_boot_server_t *server);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue