From 645f474d65dbe8f0d755fea5a144e637f9485a93 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Tue, 24 Jun 2008 11:21:20 -0400 Subject: Make details plugin go back to default plugin if escape is pressed again This fixes the TODO item: - consider making details plugin go back to pretty plugin if user presses escape --- TODO | 1 - src/main.c | 35 +++++++++++++++++++++++++++++++++-- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/TODO b/TODO index f56ea9d..6570dc7 100644 --- a/TODO +++ b/TODO @@ -5,7 +5,6 @@ - Make --ask-for-password take a prompt message - consider making details plugin have stdin hooked up to the pty instead of tty so input works - More on the last point, we need to have an escape hatch for fsck etc -- consider making details plugin go back to pretty plugin if user presses escape - add expose handler for plugins to draw from. We need to reset some state every frame of the animation, so better to hide that. - rotate boot.log per boot cycle (might be easiest to just fork/exec out to logrotate directly) - fix error handling. In particular, ply_open_module gets it completely wrong (replies on errno instead of dlerror()) diff --git a/src/main.c b/src/main.c index 7fe4d15..7af0b16 100644 --- a/src/main.c +++ b/src/main.c @@ -57,6 +57,7 @@ typedef struct long ptmx; char kernel_command_line[PLY_MAX_COMMAND_LINE_SIZE]; + uint32_t showing_details : 1; } state_t; static ply_boot_splash_t *start_boot_splash (state_t *state, @@ -124,7 +125,21 @@ on_system_initialized (state_t *state) } static void -on_show_splash (state_t *state) +show_detailed_splash (state_t *state) +{ + ply_trace ("Showing detailed splash screen"); + state->boot_splash = start_boot_splash (state, + PLYMOUTH_PLUGIN_PATH "details.so"); + + if (state->boot_splash == NULL) + { + ply_trace ("Could not start detailed splash screen, exiting"); + exit (1); + } +} + +static void +show_default_splash (state_t *state) { ply_trace ("Showing splash screen"); state->boot_splash = start_boot_splash (state, @@ -142,6 +157,12 @@ on_show_splash (state_t *state) ply_error ("could not start boot splash: %m"); } +static void +on_show_splash (state_t *state) +{ + show_default_splash (state); +} + static void on_quit (state_t *state) { @@ -190,9 +211,19 @@ on_escape_pressed (state_t *state) { ply_boot_splash_hide (state->boot_splash); ply_boot_splash_free (state->boot_splash); + state->boot_splash = NULL; } - state->boot_splash = start_boot_splash (state, PLYMOUTH_PLUGIN_PATH "details.so"); + if (!state->showing_details) + { + show_detailed_splash (state); + state->showing_details = true; + } + else + { + show_default_splash (state); + state->showing_details = false; + } } static ply_window_t * -- cgit