From 100cb2cfc3ee4040ab969215e3cd8cc885f9efeb Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Wed, 1 May 2013 10:03:31 +0800 Subject: cui: Show incoming status messages Add a callback to handle and display boot status messages from the discover server. Signed-off-by: Jeremy Kerr --- ui/ncurses/nc-cui.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'ui') 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, }; /** -- cgit v1.2.1