diff -ru 0.8.2-2ubuntu2.1/debian/changelog 0.8.2-2ubuntu2.2/debian/changelog --- 0.8.2-2ubuntu2.1/debian/changelog 2010-10-31 01:20:36.000000000 +0100 +++ 0.8.2-2ubuntu2.2/debian/changelog 2010-11-23 11:05:08.000000000 +0000 @@ -1,3 +1,11 @@ +plymouth (0.8.2-2ubuntu2.2) lucid-proposed; urgency=low + + * src/plugins/splash/details/plugin.c: Implement display_message, either + by displaying it immediately or by queueing it for later display in the + event that we're already waiting for user input (LP: #563916). + + -- Colin Watson Tue, 23 Nov 2010 11:05:04 +0000 + plymouth (0.8.2-2ubuntu2.1) lucid-proposed; urgency=low * Generate a dummy NSS stack in the initrd to suppress a glib warning diff -ru 0.8.2-2ubuntu2.1/debian/patches/debian-changes 0.8.2-2ubuntu2.2/debian/patches/debian-changes diff -ru 0.8.2-2ubuntu2.1/src/plugins/splash/details/plugin.c 0.8.2-2ubuntu2.2/src/plugins/splash/details/plugin.c --- 0.8.2-2ubuntu2.1/src/plugins/splash/details/plugin.c 2010-11-23 11:08:28.000000000 +0000 +++ 0.8.2-2ubuntu2.2/src/plugins/splash/details/plugin.c 2010-11-23 11:08:32.000000000 +0000 @@ -73,6 +73,7 @@ ply_boot_splash_mode_t mode; ply_list_t *views; ply_boot_splash_display_type_t state; + ply_list_t *messages; }; @@ -120,6 +121,31 @@ 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) { @@ -130,6 +156,7 @@ 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; } @@ -141,6 +168,7 @@ if (plugin == NULL) return; + free_messages (plugin); free_views (plugin); free (plugin); @@ -297,10 +325,28 @@ 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 @@ -352,6 +398,26 @@ write_on_views (plugin, entry_text, strlen (entry_text)); } +static void +display_message (ply_boot_splash_plugin_t *plugin, + const char *message) +{ + const char *message_to_display; + + if (!strncmp (message, "keys:", strlen ("keys:"))) + message_to_display = message + strlen ("keys:"); + else + message_to_display = message; + + if (plugin->state == PLY_BOOT_SPLASH_DISPLAY_NORMAL) + { + write_on_views (plugin, message_to_display, strlen (message_to_display)); + write_on_views (plugin, "\r\n", strlen ("\r\n")); + } + else + ply_list_append_data (plugin->messages, strdup (message_to_display)); +} + ply_boot_splash_plugin_interface_t * ply_boot_splash_plugin_get_interface (void) { @@ -368,6 +434,7 @@ .display_normal = display_normal, .display_password = display_password, .display_question = display_question, + .display_message = display_message, }; return &plugin_interface;