From: Jeremy Kerr Date: Wed, 1 May 2013 02:03:31 +0000 (+0800) Subject: cui: Show incoming status messages X-Git-Tag: v1.0.0~669 X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=commitdiff_plain;h=100cb2cfc3ee4040ab969215e3cd8cc885f9efeb;ds=sidebyside cui: Show incoming status messages Add a callback to handle and display boot status messages from the discover server. Signed-off-by: Jeremy Kerr --- diff --git a/ui/ncurses/nc-cui.c b/ui/ncurses/nc-cui.c index c26819f..f165637 100644 --- a/ui/ncurses/nc-cui.c +++ b/ui/ncurses/nc-cui.c @@ -147,11 +147,7 @@ static int cui_boot(struct pmenu_item *item) reset_prog_mode(); redrawwin(cui->current->main_ncw); - if (!result) { - clear(); - mvaddstr(1, 0, "system is going down now..."); - refresh(); - } else { + if (result) { nc_scr_status_printf(cui->current, "Failed: boot %s", cod->bd->image); } @@ -492,10 +488,22 @@ static void cui_device_remove(struct device *dev, void *arg) cui->current->post(cui->current); } +static void cui_update_status(struct boot_status *status, void *arg) +{ + struct cui *cui = cui_from_arg(arg); + + nc_scr_status_printf(cui->current, + "%s: %s", + status->type == BOOT_STATUS_ERROR ? "Error" : "Info", + status->message); + +} + 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, }; /**