[PATCH 7/9] add a message display method
Ray Strode
halfline at gmail.com
Mon Feb 23 13:52:29 PST 2009
Hi,
On Mon, Feb 23, 2009 at 3:35 PM, <william.jon.mccann at gmail.com> wrote:
> From: William Jon McCann <jmccann at redhat.com>
>
> Useful for showing messages like "Shutting down..." etc. A plugin
> may choose not to support this feature.
Sounds good. I do have some vague recollection of Charlie already
adding something like this, but maybe I'm crazy.
Charlie, you reading this? Am I crazy?
> diff --git a/src/client/plymouth.c b/src/client/plymouth.c
> index 60e86fb..fd8f948 100644
> --- a/src/client/plymouth.c
> +++ b/src/client/plymouth.c
[...]
> @@ -619,6 +619,7 @@ main (int argc,
> "ask-for-password", "Ask user for password", PLY_COMMAND_OPTION_TYPE_FLAG,
> "ignore-keystroke", "Remove sensitivity to a keystroke", PLY_COMMAND_OPTION_TYPE_STRING,
> "update", "Tell boot daemon an update about boot progress", PLY_COMMAND_OPTION_TYPE_STRING,
> + "message", "Tell boot daemon to display a message", PLY_COMMAND_OPTION_TYPE_STRING,
> "details", "Tell boot daemon there were errors during boot", PLY_COMMAND_OPTION_TYPE_FLAG,
> "wait", "Wait for boot daemon to quit", PLY_COMMAND_OPTION_TYPE_FLAG,
> NULL);
> @@ -706,6 +707,7 @@ main (int argc,
> "sysinit", &should_sysinit,
> "show-splash", &should_show_splash,
> "hide-splash", &should_hide_splash,
> + "message", &message,
> "ask-for-password", &should_ask_for_password,
> "ignore-keystroke", &ignore_keystroke,
> "update", &status,
So, when I first wrote the client all command line arguments were of the form:
plymouth --option
Kristian convinced me to go to the git form of
plymouth command --option
But I did a half-assed job, and there are still some --option types
there for compatibility with the scripts calling it. I do sort of
think that all new code should add commands instead of options though.
[...]
> --- a/src/plugins/splash/text/plugin.c
> +++ b/src/plugins/splash/text/plugin.c
[...]
> @@ -107,17 +110,45 @@ destroy_plugin (ply_boot_splash_plugin_t *plugin)
> hide_splash_screen (plugin, plugin->loop);
>
> ply_text_progress_bar_free (plugin->progress_bar);
> + if (plugin->message != NULL)
> + free (plugin->message);
free allows NULL, so ditch the check.
[...]
> static void
> +show_message (ply_boot_splash_plugin_t *plugin)
> +{
> + int window_width, window_height;
> + int i;
> +
> + window_width = ply_window_get_number_of_text_columns (plugin->window);
> + window_height = ply_window_get_number_of_text_rows (plugin->window);
> +
> + ply_window_set_text_cursor_position (plugin->window,
> + 0, window_height / 2);
> +
> + for (i=0; i < window_width; i++)
> + {
> + write (STDOUT_FILENO, " ", strlen (" "));
> + }
Are you trying to clear the line here? There is a helper function for that.
I think it's ply_window_clear_line_text or something.
Rest looks good.
--Ray
More information about the plymouth
mailing list