summaryrefslogtreecommitdiffstats
path: root/ui/ncurses/nc-cui.c
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-10-17 13:52:42 +0800
committerJeremy Kerr <jk@ozlabs.org>2013-11-13 17:47:20 +0800
commit651940467773d2e679f9210e02f4654fb05cd449 (patch)
tree5268fc4a6ec34a3aaffb89bec2ba0bbca454fb5c /ui/ncurses/nc-cui.c
parent8f36cfac8a6cbb9a2750824b704b3cc4b9db5c49 (diff)
downloadtalos-petitboot-651940467773d2e679f9210e02f4654fb05cd449.tar.gz
talos-petitboot-651940467773d2e679f9210e02f4654fb05cd449.zip
ui/ncurses: Add sysinfo screen
Add a simple screen for displaying the struct system_info. We add this to the main menu as a selectable option, and separate it from the boot option list with an unselectable blank entry. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'ui/ncurses/nc-cui.c')
-rw-r--r--ui/ncurses/nc-cui.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/ui/ncurses/nc-cui.c b/ui/ncurses/nc-cui.c
index b734cdc..5f41196 100644
--- a/ui/ncurses/nc-cui.c
+++ b/ui/ncurses/nc-cui.c
@@ -34,6 +34,7 @@
#include "process/process.h"
#include "ui/common/discover-client.h"
#include "nc-cui.h"
+#include "nc-sysinfo.h"
static struct cui_opt_data *cod_from_item(struct pmenu_item *item)
{
@@ -236,6 +237,20 @@ void cui_item_new(struct pmenu *menu)
cui_set_current(cui, &boot_editor->scr);
}
+static void cui_sysinfo_exit(struct cui *cui)
+{
+ cui_set_current(cui, &cui->main->scr);
+ talloc_free(cui->sysinfo_screen);
+ cui->sysinfo_screen = NULL;
+}
+
+void cui_show_sysinfo(struct cui *cui)
+{
+ cui->sysinfo_screen = sysinfo_screen_init(cui, cui->sysinfo,
+ cui_sysinfo_exit);
+ cui_set_current(cui, sysinfo_screen_scr(cui->sysinfo_screen));
+}
+
/**
* cui_set_current - Set the currently active screen and redraw it.
*/
@@ -506,6 +521,12 @@ static void cui_update_sysinfo(struct system_info *sysinfo, void *arg)
{
struct cui *cui = cui_from_arg(arg);
cui->sysinfo = talloc_steal(cui, sysinfo);
+
+ /* if we're currently displaying the system info screen, inform it
+ * of the updated information. */
+ if (cui->sysinfo_screen)
+ sysinfo_screen_update(cui->sysinfo_screen, sysinfo);
+
cui_update_mm_title(cui);
}
OpenPOWER on IntegriCloud