]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
Create a buffer to hold boot messages and pass that buffer to plugin show functions
authorRay Strode <rstrode@redhat.com>
Tue, 20 May 2008 02:54:46 +0000 (22:54 -0400)
committerRay Strode <rstrode@redhat.com>
Tue, 20 May 2008 02:54:46 +0000 (22:54 -0400)
src/main.c
src/ply-boot-splash-plugin.h
src/ply-boot-splash.c
src/ply-boot-splash.h
src/splash-plugins/details/details.c
src/splash-plugins/fedora-fade-in/fedora-fade-in.c
src/splash-plugins/text/text.c

index 4591211128cfffb37606892a8f635eb1cc47fbce..296e719ca8aba4ca732c426aac4f717fd8a158f3 100644 (file)
@@ -49,6 +49,7 @@ typedef struct
   ply_window_t *window;
   ply_boot_splash_t *boot_splash;
   ply_terminal_session_t *session;
+  ply_buffer_t *boot_buffer;
   int original_root_dir_fd;
 } state_t;
 
@@ -192,7 +193,7 @@ start_boot_splash (state_t    *state,
 
   ply_trace ("Loading boot splash plugin '%s'",
              module_path);
-  splash = ply_boot_splash_new (module_path, state->window);
+  splash = ply_boot_splash_new (module_path, state->window, state->boot_buffer);
 
   ply_trace ("attaching plugin to event loop");
   ply_boot_splash_attach_to_event_loop (splash, state->loop);
@@ -227,6 +228,9 @@ spawn_session (state_t  *state,
   ply_trace ("attaching terminal session to event loop");
   ply_terminal_session_attach_to_event_loop (session, state->loop);
 
+  ply_trace ("buffering terminal session for replay if user presses escape");
+  ply_terminal_session_set_output_buffer (session, state->boot_buffer);
+
   ply_trace ("running '%s'", argv[0]);
   if (!ply_terminal_session_run (session, flags,
                                  (ply_terminal_session_begin_handler_t)
@@ -236,6 +240,8 @@ spawn_session (state_t  *state,
     {
       ply_save_errno ();
       ply_terminal_session_free (session);
+      ply_buffer_free (state->boot_buffer);
+      state->boot_buffer = NULL;
       ply_restore_errno ();
       return NULL;
     }
@@ -455,6 +461,8 @@ main (int    argc,
       return EX_OSERR;
     }
 
+  state.boot_buffer = ply_buffer_new ();
+
   state.session = spawn_session (&state, argv + 1);
 
   if (state.session == NULL)
@@ -504,6 +512,8 @@ main (int    argc,
   ply_trace ("freeing terminal session");
   ply_terminal_session_free (state.session);
 
+  ply_buffer_free (state.boot_buffer);
+
   ply_trace ("freeing event loop");
   ply_event_loop_free (state.loop);
 
index 78fb3c56166fadd6b40d7c55fbac5af2fb1e0ed4..29aef6e7bd71fa753284b987f637f1a0e04cdae7 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "ply-event-loop.h"
 #include "ply-window.h"
+#include "ply-buffer.h"
 
 typedef struct _ply_boot_splash_plugin ply_boot_splash_plugin_t;
 
@@ -37,7 +38,8 @@ typedef struct
   void (* destroy_plugin) (ply_boot_splash_plugin_t *plugin);
 
   bool (* show_splash_screen) (ply_boot_splash_plugin_t *plugin,
-                               ply_window_t             *window);
+                               ply_window_t             *window,
+                               ply_buffer_t             *boot_buffer);
   void (* update_status) (ply_boot_splash_plugin_t *plugin,
                           const char               *status);
   void (* hide_splash_screen) (ply_boot_splash_plugin_t *plugin,
index 59091d79c9ef3b83c26c7e954542ab359935a463..922f5f16f5cb1d043cd659efefe6aa2808793d23 100644 (file)
@@ -45,6 +45,7 @@ struct _ply_boot_splash
   const ply_boot_splash_plugin_interface_t *plugin_interface;
   ply_boot_splash_plugin_t *plugin;
   ply_window_t *window;
+  ply_buffer_t *boot_buffer;
 
   char *module_name;
   char *status;
@@ -57,7 +58,8 @@ typedef const ply_boot_splash_plugin_interface_t *
 
 ply_boot_splash_t *
 ply_boot_splash_new (const char   *module_name,
-                     ply_window_t *window)
+                     ply_window_t *window,
+                     ply_buffer_t *boot_buffer)
 {
   ply_boot_splash_t *splash;
 
@@ -70,6 +72,7 @@ ply_boot_splash_new (const char   *module_name,
   splash->is_shown = false;
 
   splash->window = window;
+  splash->boot_buffer = boot_buffer;
 
   return splash;
 }
@@ -187,7 +190,8 @@ ply_boot_splash_show (ply_boot_splash_t *splash)
 
   ply_trace ("showing splash screen\n");
   if (!splash->plugin_interface->show_splash_screen (splash->plugin,
-                                                     splash->window))
+                                                     splash->window,
+                                                     splash->boot_buffer))
     {
 
       ply_save_errno ();
@@ -304,6 +308,7 @@ main (int    argc,
   ply_event_loop_t *loop;
   ply_boot_splash_t *splash;
   ply_window_t *window;
+  ply_buffer_t *buffer;
   int exit_code;
   const char *module_name;
 
@@ -327,7 +332,8 @@ main (int    argc,
   ply_window_attach_to_event_loop (window, loop);
   ply_window_set_escape_handler (window, (ply_window_escape_handler_t)on_quit, loop);
 
-  splash = ply_boot_splash_new (module_name, window);
+  buffer = ply_buffer_new ();
+  splash = ply_boot_splash_new (module_name, window, buffer);
   ply_boot_splash_attach_to_event_loop (splash, loop);
 
   if (!ply_boot_splash_show (splash))
@@ -343,6 +349,7 @@ main (int    argc,
                                    splash);
   exit_code = ply_event_loop_run (loop);
   ply_boot_splash_free (splash);
+  ply_buffer_free (buffer);
 
   return exit_code;
 }
index 6689beb6613c0be56f1f521dfbc0920d188a9bf3..b314378285e396051ef8cee029f954991d1f2298 100644 (file)
 
 #include "ply-event-loop.h"
 #include "ply-window.h"
+#include "ply-buffer.h"
 
 typedef struct _ply_boot_splash ply_boot_splash_t;
 
 #ifndef PLY_HIDE_FUNCTION_DECLARATIONS
 ply_boot_splash_t *ply_boot_splash_new (const char *module_name,
-                                        ply_window_t *window);
+                                        ply_window_t *window,
+                                        ply_buffer_t *boot_buffer);
 void ply_boot_splash_free (ply_boot_splash_t *splash);
 bool ply_boot_splash_show (ply_boot_splash_t *splash);
 void ply_boot_splash_update_status (ply_boot_splash_t *splash,
index 845614120cf6536c952303c99a019fae6b7b45e0..de4749d9490e7614d6d8b6ca48956016e87ced7a 100644 (file)
@@ -80,7 +80,8 @@ destroy_plugin (ply_boot_splash_plugin_t *plugin)
 
 bool
 show_splash_screen (ply_boot_splash_plugin_t *plugin,
-                    ply_window_t             *window)
+                    ply_window_t             *window,
+                    ply_buffer_t             *boot_buffer)
 {
   assert (plugin != NULL);
 
index c09a68bfd97fd5c0d3a359c8a66f54aac9f7e971..3502170804c07a93e302f2c31264439e849a651c 100644 (file)
@@ -321,7 +321,8 @@ on_interrupt (ply_boot_splash_plugin_t *plugin)
 
 bool
 show_splash_screen (ply_boot_splash_plugin_t *plugin,
-                    ply_window_t             *window)
+                    ply_window_t             *window,
+                    ply_buffer_t             *boot_buffer)
 {
   assert (plugin != NULL);
   assert (plugin->logo_image != NULL);
index ad00bfa5d2167ff0bd0db59858dc6f605069042e..078f755bd3bfb546551f9c26073fe8d92eaa5541 100644 (file)
@@ -96,7 +96,8 @@ open_console (ply_boot_splash_plugin_t *plugin)
 
 bool
 show_splash_screen (ply_boot_splash_plugin_t *plugin,
-                    ply_window_t             *window)
+                    ply_window_t             *window,
+                    ply_buffer_t             *boot_buffer)
 {
   assert (plugin != NULL);