summaryrefslogtreecommitdiffstats
path: root/ui/ncurses/nc-cui.c
diff options
context:
space:
mode:
authorSamuel Mendoza-Jonas <sam.mj@au1.ibm.com>2015-01-21 14:48:38 +1100
committerSamuel Mendoza-Jonas <sam.mj@au1.ibm.com>2015-05-05 15:03:37 +1000
commit6bb1301835dbd6ff54e1becb5b684fedb0e4caaf (patch)
tree6dc63f7b6c75e0a2c8f62f2d747c45f9a96dcc0c /ui/ncurses/nc-cui.c
parent60252961c21a0f102e69373f2bea36f8af495c29 (diff)
downloadtalos-petitboot-6bb1301835dbd6ff54e1becb5b684fedb0e4caaf.tar.gz
talos-petitboot-6bb1301835dbd6ff54e1becb5b684fedb0e4caaf.zip
ui/ncurses: Add nc-subset selection screen
The nc-subset screen is intended to be used as a sub-screen from the current screen (eg. nc-config) which passes a pointer to a nc_widget_subset struct. The nc-subset screen allows the user to select an option from a list of 'inactive' options, before returning control back to the current screen. Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
Diffstat (limited to 'ui/ncurses/nc-cui.c')
-rw-r--r--ui/ncurses/nc-cui.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/ui/ncurses/nc-cui.c b/ui/ncurses/nc-cui.c
index 8e31fe2..2fc779e 100644
--- a/ui/ncurses/nc-cui.c
+++ b/ui/ncurses/nc-cui.c
@@ -41,6 +41,7 @@
#include "nc-sysinfo.h"
#include "nc-lang.h"
#include "nc-helpscreen.h"
+#include "nc-subset.h"
extern const struct help_text main_menu_help_text;
@@ -328,6 +329,29 @@ void cui_show_help(struct cui *cui, const char *title,
cui_set_current(cui, help_screen_scr(cui->help_screen));
}
+static void cui_subset_exit(struct cui *cui)
+{
+ cui_set_current(cui, subset_screen_return_scr(cui->subset_screen));
+ talloc_free(cui->subset_screen);
+ cui->subset_screen = NULL;
+}
+
+void cui_show_subset(struct cui *cui, const char *title,
+ void *arg)
+{
+ if (!cui->current)
+ return;
+
+ if (cui->subset_screen)
+ return;
+
+ cui->subset_screen = subset_screen_init(cui, cui->current,
+ title, arg, cui_subset_exit);
+
+ if (cui->subset_screen)
+ cui_set_current(cui, subset_screen_scr(cui->subset_screen));
+}
+
/**
* cui_set_current - Set the currently active screen and redraw it.
*/
OpenPOWER on IntegriCloud