]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
[main] Create a list of messages and when showing splash display them
authorSteve Langasek <steve.langasek@canonical.com>
Tue, 20 Apr 2010 11:02:24 +0000 (12:02 +0100)
committerCharlie Brej <cbrej@cs.man.ac.uk>
Tue, 20 Apr 2010 11:08:05 +0000 (12:08 +0100)
The system now keeps a list of messages so they can be shown again when the
user flips themes or if the messages were passed before the splash was shown.

This also enables the splashes to show multiple messages (should they choose to
do so). There will later be a way of undisplaying a message.

src/main.c

index 40fff0f52e212a481bac1bc4df5bb45381139579..0ae6500de0a8341e91006ddff5f8f6b2be33cf98 100644 (file)
@@ -91,6 +91,7 @@ typedef struct
   ply_list_t *keystroke_triggers;
   ply_list_t *entry_triggers;
   ply_buffer_t *entry_buffer;
+  ply_list_t *messages;
   ply_command_parser_t *command_parser;
   ply_mode_t mode;
   ply_renderer_t *renderer;
@@ -171,6 +172,23 @@ on_update (state_t     *state,
                                    status);
 }
 
+static void
+show_messages (state_t *state)
+{
+  ply_list_node_t *node = ply_list_get_first_node (state->messages);
+  while (node != NULL)
+    {
+      ply_list_node_t *next_node;
+      char *message = ply_list_node_get_data (node);
+
+      ply_trace ("displaying messages");
+
+      ply_boot_splash_display_message (state->boot_splash, message);
+      next_node = ply_list_get_next_node (state->messages, node);
+      node = next_node;
+    }
+}
+
 static void
 show_detailed_splash (state_t *state)
 {
@@ -374,6 +392,7 @@ on_display_message (state_t       *state,
   ply_trace ("displaying message %s", message);
   if (state->boot_splash != NULL)
     ply_boot_splash_display_message (state->boot_splash, message);
+  ply_list_append_data (state->messages, strdup(message));
 }
 
 static void
@@ -719,6 +738,7 @@ on_show_splash (state_t *state)
       show_detailed_splash (state);
       state->showing_details = true;
     }
+  show_messages (state);
 }
 
 static void
@@ -1123,6 +1143,7 @@ toggle_between_splash_and_details (state_t *state)
       state->showing_details = false;
     }
   update_display (state);
+  show_messages (state);
 }
 
 static void
@@ -1680,6 +1701,7 @@ initialize_environment (state_t *state)
   state->entry_buffer = ply_buffer_new();
   state->pixel_displays = ply_list_new ();
   state->text_displays = ply_list_new ();
+  state->messages = ply_list_new ();
   state->keyboard = NULL;
 
   if (!state->default_tty)