summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-12-10 15:08:47 +0800
committerJeremy Kerr <jk@ozlabs.org>2014-01-31 08:46:34 +0800
commit6e46a2e3a2d69e1982ed531ed69def8f9a5e8af1 (patch)
tree7dc14f64e9095a5c2c2871eba7b95ad0eea50f9c /ui
parent140f5b13c7513b2d594457cc8d7d0cb1a7d844a4 (diff)
downloadtalos-petitboot-6e46a2e3a2d69e1982ed531ed69def8f9a5e8af1.tar.gz
talos-petitboot-6e46a2e3a2d69e1982ed531ed69def8f9a5e8af1.zip
ui/ncurses: Add help text to nc-menu & generic-main
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'ui')
-rw-r--r--ui/ncurses/Makefile.am2
-rw-r--r--ui/ncurses/generic-main-help.c17
-rw-r--r--ui/ncurses/generic-main.c7
-rw-r--r--ui/ncurses/nc-menu.c5
-rw-r--r--ui/ncurses/nc-menu.h2
5 files changed, 31 insertions, 2 deletions
diff --git a/ui/ncurses/Makefile.am b/ui/ncurses/Makefile.am
index 8160298..5389ed9 100644
--- a/ui/ncurses/Makefile.am
+++ b/ui/ncurses/Makefile.am
@@ -55,7 +55,7 @@ sbin_PROGRAMS += petitboot-ps3-nc
endif
-petitboot_nc_SOURCES = generic-main.c
+petitboot_nc_SOURCES = generic-main.c generic-main-help.c
petitboot_nc_LDADD = $(common_libs)
petitboot_ps3_nc_SOURCES = ps3-main.c
diff --git a/ui/ncurses/generic-main-help.c b/ui/ncurses/generic-main-help.c
new file mode 100644
index 0000000..d3c5662
--- /dev/null
+++ b/ui/ncurses/generic-main-help.c
@@ -0,0 +1,17 @@
+
+const char *main_menu_help_text =
+"From the main menu screen, select a boot option. The options displayed are \
+available on the system and the network.\n\
+\n\
+To select a boot option, press Enter.\n\
+\n\
+To make changes to an existing option, type E (edit).\n\
+\n\
+To add a new boot option, type N (new).\n\
+\n\
+To display information about the system, including the MAC addresses of each \
+network interface, type I (information).\n\
+\n\
+To make changes to the system configuration, type C (configure).\n\
+\n\
+To close the Petitboot interface, type X (exit).\n";
diff --git a/ui/ncurses/generic-main.c b/ui/ncurses/generic-main.c
index aa5c2a5..7616788 100644
--- a/ui/ncurses/generic-main.c
+++ b/ui/ncurses/generic-main.c
@@ -36,6 +36,8 @@
#include "ui/common/discover-client.h"
#include "nc-cui.h"
+extern const char *main_menu_help_text;
+
static void print_version(void)
{
printf("petitboot-nc (" PACKAGE_NAME ") " PACKAGE_VERSION "\n");
@@ -161,7 +163,7 @@ static struct pmenu *pb_mm_init(struct pb_cui *pb_cui)
"Petitboot (" PACKAGE_VERSION ")");
m->scr.frame.rtitle = NULL;
m->scr.frame.help = talloc_strdup(m,
- "Enter=accept, e=edit, n=new, x=exit");
+ "Enter=accept, e=edit, n=new, x=exit, h=help");
m->scr.frame.status = talloc_strdup(m, "Welcome to Petitboot");
i = pmenu_item_init(m, 0, " ");
@@ -181,6 +183,9 @@ static struct pmenu *pb_mm_init(struct pb_cui *pb_cui)
goto fail_setup;
}
+ m->help_title = "main menu";
+ m->help_text = main_menu_help_text;
+
menu_opts_off(m->ncm, O_SHOWDESC);
set_menu_mark(m->ncm, " *");
set_current_item(m->ncm, i->nci);
diff --git a/ui/ncurses/nc-menu.c b/ui/ncurses/nc-menu.c
index d2048e1..7533f30 100644
--- a/ui/ncurses/nc-menu.c
+++ b/ui/ncurses/nc-menu.c
@@ -250,6 +250,11 @@ static void pmenu_process_key(struct nc_scr *scr, int key)
case 'c':
cui_show_config(cui_from_arg(scr->ui_ctx));
break;
+ case 'h':
+ if (menu->help_text)
+ cui_show_help(cui_from_arg(scr->ui_ctx),
+ menu->help_title, menu->help_text);
+ break;
default:
menu_driver(menu->ncm, key);
break;
diff --git a/ui/ncurses/nc-menu.h b/ui/ncurses/nc-menu.h
index 4639c55..f5e947d 100644
--- a/ui/ncurses/nc-menu.h
+++ b/ui/ncurses/nc-menu.h
@@ -90,6 +90,8 @@ struct pmenu {
ITEM **items;
unsigned int item_count;
unsigned int insert_pt;
+ const char *help_title;
+ const char *help_text;
int (*hot_key)(struct pmenu *menu, struct pmenu_item *item, int c);
void (*on_exit)(struct pmenu *menu);
void (*on_new)(struct pmenu *menu);
OpenPOWER on IntegriCloud