summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
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