mirror of
https://gitlab.freedesktop.org/plymouth/plymouth.git
synced 2026-05-09 05:58:27 +02:00
details: Implement display_message
Messages are queued until any question or password entry prompts complete. https://bugs.freedesktop.org/show_bug.cgi?id=29035
This commit is contained in:
parent
76222a08e8
commit
e61e740e64
1 changed files with 60 additions and 0 deletions
|
|
@ -75,6 +75,7 @@ struct _ply_boot_splash_plugin
|
|||
ply_boot_splash_mode_t mode;
|
||||
ply_list_t *views;
|
||||
ply_boot_splash_display_type_t state;
|
||||
ply_list_t *messages;
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -122,6 +123,31 @@ free_views (ply_boot_splash_plugin_t *plugin)
|
|||
plugin->views = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
free_messages (ply_boot_splash_plugin_t *plugin)
|
||||
{
|
||||
ply_list_node_t *node;
|
||||
|
||||
node = ply_list_get_first_node (plugin->messages);
|
||||
|
||||
while (node != NULL)
|
||||
{
|
||||
ply_list_node_t *next_node;
|
||||
char *message;
|
||||
|
||||
message = ply_list_node_get_data (node);
|
||||
next_node = ply_list_get_next_node (plugin->messages, node);
|
||||
|
||||
free (message);
|
||||
ply_list_remove_node (plugin->messages, node);
|
||||
|
||||
node = next_node;
|
||||
}
|
||||
|
||||
ply_list_free (plugin->messages);
|
||||
plugin->messages = NULL;
|
||||
}
|
||||
|
||||
static ply_boot_splash_plugin_t *
|
||||
create_plugin (ply_key_file_t *key_file)
|
||||
{
|
||||
|
|
@ -132,6 +158,7 @@ create_plugin (ply_key_file_t *key_file)
|
|||
plugin = calloc (1, sizeof (ply_boot_splash_plugin_t));
|
||||
plugin->views = ply_list_new ();
|
||||
plugin->state = PLY_BOOT_SPLASH_DISPLAY_NORMAL;
|
||||
plugin->messages = ply_list_new ();
|
||||
return plugin;
|
||||
}
|
||||
|
||||
|
|
@ -151,6 +178,7 @@ destroy_plugin (ply_boot_splash_plugin_t *plugin)
|
|||
detach_from_event_loop (plugin);
|
||||
}
|
||||
|
||||
free_messages (plugin);
|
||||
free_views (plugin);
|
||||
|
||||
free (plugin);
|
||||
|
|
@ -307,10 +335,28 @@ hide_splash_screen (ply_boot_splash_plugin_t *plugin,
|
|||
static void
|
||||
display_normal (ply_boot_splash_plugin_t *plugin)
|
||||
{
|
||||
ply_list_node_t *node;
|
||||
|
||||
if (plugin->state != PLY_BOOT_SPLASH_DISPLAY_NORMAL)
|
||||
write_on_views (plugin, "\r\n", strlen ("\r\n"));
|
||||
|
||||
plugin->state = PLY_BOOT_SPLASH_DISPLAY_NORMAL;
|
||||
|
||||
node = ply_list_get_first_node (plugin->messages);
|
||||
while (node != NULL)
|
||||
{
|
||||
const char *message;
|
||||
ply_list_node_t *next_node;
|
||||
|
||||
message = ply_list_node_get_data (node);
|
||||
next_node = ply_list_get_next_node (plugin->messages, node);
|
||||
|
||||
write_on_views (plugin, message, strlen (message));
|
||||
write_on_views (plugin, "\r\n", strlen ("\r\n"));
|
||||
|
||||
ply_list_remove_node (plugin->messages, node);
|
||||
node = next_node;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -362,6 +408,19 @@ display_question (ply_boot_splash_plugin_t *plugin,
|
|||
write_on_views (plugin, entry_text, strlen (entry_text));
|
||||
}
|
||||
|
||||
static void
|
||||
display_message (ply_boot_splash_plugin_t *plugin,
|
||||
const char *message)
|
||||
{
|
||||
if (plugin->state == PLY_BOOT_SPLASH_DISPLAY_NORMAL)
|
||||
{
|
||||
write_on_views (plugin, message, strlen (message));
|
||||
write_on_views (plugin, "\r\n", strlen ("\r\n"));
|
||||
}
|
||||
else
|
||||
ply_list_append_data (plugin->messages, strdup (message));
|
||||
}
|
||||
|
||||
ply_boot_splash_plugin_interface_t *
|
||||
ply_boot_splash_plugin_get_interface (void)
|
||||
{
|
||||
|
|
@ -378,6 +437,7 @@ ply_boot_splash_plugin_get_interface (void)
|
|||
.display_normal = display_normal,
|
||||
.display_password = display_password,
|
||||
.display_question = display_question,
|
||||
.display_message = display_message,
|
||||
};
|
||||
|
||||
return &plugin_interface;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue