diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2013-12-10 11:48:25 +0800 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2014-01-31 08:46:34 +0800 |
commit | 140f5b13c7513b2d594457cc8d7d0cb1a7d844a4 (patch) | |
tree | 963071659ac423bf8c7f4da9a67460556d228fc2 /ui/ncurses/nc-cui.c | |
parent | 702f9c313dea66817cf05196d84cd07889e80c51 (diff) | |
download | petitboot-140f5b13c7513b2d594457cc8d7d0cb1a7d844a4.zip petitboot-140f5b13c7513b2d594457cc8d7d0cb1a7d844a4.tar.gz |
ui/ncurses: Add support for help screens
Add a textscreen-based help screen system, triggered from the cui
module's cui_show_help()
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'ui/ncurses/nc-cui.c')
-rw-r--r-- | ui/ncurses/nc-cui.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/ui/ncurses/nc-cui.c b/ui/ncurses/nc-cui.c index e342273..650e903 100644 --- a/ui/ncurses/nc-cui.c +++ b/ui/ncurses/nc-cui.c @@ -38,6 +38,7 @@ #include "nc-boot-editor.h" #include "nc-config.h" #include "nc-sysinfo.h" +#include "nc-helpscreen.h" static void cui_start(void) { @@ -246,6 +247,28 @@ void cui_show_config(struct cui *cui) cui_set_current(cui, config_screen_scr(cui->config_screen)); } +static void cui_help_exit(struct cui *cui) +{ + cui_set_current(cui, help_screen_return_scr(cui->help_screen)); + talloc_free(cui->help_screen); + cui->help_screen = NULL; +} + +void cui_show_help(struct cui *cui, const char *title, const char *text) +{ + if (!cui->current) + return; + + if (cui->help_screen) + return; + + cui->help_screen = help_screen_init(cui, cui->current, + title, text, cui_help_exit); + + if (cui->help_screen) + cui_set_current(cui, help_screen_scr(cui->help_screen)); +} + /** * cui_set_current - Set the currently active screen and redraw it. */ |