diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2013-10-09 16:48:38 +0800 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2013-10-09 17:40:41 +0800 |
commit | 47bc66a0c744f68a84147b0bd616ab25a242fb70 (patch) | |
tree | 13aad60595c03209847954c0222a37db81f7a85f /ui/ncurses/nc-cui.c | |
parent | 8ec7ea724de780a6a428a8485b2760bf1d9e0a4e (diff) | |
download | talos-petitboot-47bc66a0c744f68a84147b0bd616ab25a242fb70.tar.gz talos-petitboot-47bc66a0c744f68a84147b0bd616ab25a242fb70.zip |
ui/ncurses: Display sysinfo type & identifier
Hook into the sysinfo updates to display the type & id at the top of the
petitboot main menu.
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 4f7b121..35c9deb 100644 --- a/ui/ncurses/nc-cui.c +++ b/ui/ncurses/nc-cui.c @@ -473,11 +473,34 @@ static void cui_update_status(struct boot_status *status, void *arg) } +static void cui_update_mm_title(struct cui *cui) +{ + struct nc_frame *frame = &cui->main->scr.frame; + + talloc_free(frame->rtitle); + + frame->rtitle = talloc_strdup(cui->main, cui->sysinfo->type); + if (cui->sysinfo->identifier) + frame->rtitle = talloc_asprintf_append(frame->rtitle, + " %s", cui->sysinfo->identifier); + + if (cui->current == &cui->main->scr) + cui->current->post(cui->current); +} + +static void cui_update_sysinfo(struct system_info *sysinfo, void *arg) +{ + struct cui *cui = cui_from_arg(arg); + cui->sysinfo = talloc_steal(cui, sysinfo); + cui_update_mm_title(cui); +} + static struct discover_client_ops cui_client_ops = { .device_add = NULL, .boot_option_add = cui_boot_option_add, .device_remove = cui_device_remove, .update_status = cui_update_status, + .update_sysinfo = cui_update_sysinfo, }; /** |