]> git.ozlabs.org Git - petitboot/commitdiff
cui: Show incoming status messages
authorJeremy Kerr <jk@ozlabs.org>
Wed, 1 May 2013 02:03:31 +0000 (10:03 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Mon, 6 May 2013 01:02:12 +0000 (09:02 +0800)
Add a callback to handle and display boot status messages from the
discover server.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
ui/ncurses/nc-cui.c

index c26819faeec7f988499934beb6f93902df3265f5..f1656370310fc969a201d2848ea196db4e750a2e 100644 (file)
@@ -147,11 +147,7 @@ static int cui_boot(struct pmenu_item *item)
        reset_prog_mode();
        redrawwin(cui->current->main_ncw);
 
        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);
        }
                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);
 }
 
                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,
 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,
 };
 
 /**
 };
 
 /**