mirror of
https://github.com/ipxe/ipxe
synced 2025-12-21 12:30:20 +03:00
[dynui] Allow for multiple flags on a user interface item
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -148,6 +148,7 @@ static int item_exec ( int argc, char **argv ) {
|
||||
struct item_options opts;
|
||||
struct dynamic_ui *dynui;
|
||||
struct dynamic_item *item;
|
||||
unsigned int flags = 0;
|
||||
char *name = NULL;
|
||||
char *text = NULL;
|
||||
int rc;
|
||||
@@ -174,8 +175,10 @@ static int item_exec ( int argc, char **argv ) {
|
||||
goto err_parse_dynui;
|
||||
|
||||
/* Add dynamic user interface item */
|
||||
item = add_dynui_item ( dynui, name, ( text ? text : "" ),
|
||||
opts.key, opts.is_default );
|
||||
if ( opts.is_default )
|
||||
flags |= DYNUI_DEFAULT;
|
||||
item = add_dynui_item ( dynui, name, ( text ? text : "" ), flags,
|
||||
opts.key );
|
||||
if ( ! item ) {
|
||||
rc = -ENOMEM;
|
||||
goto err_add_dynui_item;
|
||||
|
||||
@@ -267,7 +267,7 @@ int show_menu ( struct dynamic_ui *dynui, unsigned long timeout,
|
||||
if ( strcmp ( select, item->name ) == 0 )
|
||||
ui.scroll.current = ui.scroll.count;
|
||||
} else {
|
||||
if ( item->is_default )
|
||||
if ( item->flags & DYNUI_DEFAULT )
|
||||
ui.scroll.current = ui.scroll.count;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user