menu: Support entry comments
This commit is contained in:
parent
25d9fd6614
commit
9f5c5e09b4
|
@ -105,15 +105,20 @@ static struct menu_entry *create_menu_tree(struct menu_entry *parent,
|
|||
strcpy(entry->name, name + current_depth + default_expanded);
|
||||
entry->parent = parent;
|
||||
|
||||
size_t entry_size;
|
||||
char *config_entry = config_get_entry(&entry_size, i);
|
||||
entry->body = ext_mem_alloc(entry_size + 1);
|
||||
memcpy(entry->body, config_entry, entry_size);
|
||||
entry->body[entry_size] = 0;
|
||||
|
||||
if (is_directory(name, 64, current_depth, i)) {
|
||||
entry->sub = create_menu_tree(entry, current_depth + 1, i + 1);
|
||||
entry->expanded = default_expanded;
|
||||
} else {
|
||||
size_t entry_size;
|
||||
char *config_entry = config_get_entry(&entry_size, i);
|
||||
entry->body = ext_mem_alloc(entry_size + 1);
|
||||
memcpy(entry->body, config_entry, entry_size);
|
||||
entry->body[entry_size] = 0;
|
||||
}
|
||||
|
||||
char *comment = config_get_value(entry->body, 0, "COMMENT");
|
||||
if (comment != NULL) {
|
||||
entry->comment = comment;
|
||||
}
|
||||
|
||||
if (prev != NULL)
|
||||
|
|
|
@ -9,6 +9,7 @@ extern bool config_ready;
|
|||
|
||||
struct menu_entry {
|
||||
char name[64];
|
||||
char *comment;
|
||||
struct menu_entry *parent;
|
||||
struct menu_entry *sub;
|
||||
bool expanded;
|
||||
|
|
|
@ -104,6 +104,7 @@ static const char *VALID_KEYS[] = {
|
|||
"DRIVE",
|
||||
"PARTITION",
|
||||
"IMAGE_PATH",
|
||||
"COMMENT",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -593,6 +594,7 @@ refresh:
|
|||
set_cursor_pos(x, y);
|
||||
}
|
||||
|
||||
|
||||
if (selected_menu_entry->sub != NULL)
|
||||
skip_timeout = true;
|
||||
|
||||
|
@ -606,7 +608,7 @@ refresh:
|
|||
term_double_buffer_flush();
|
||||
if ((c = pit_sleep_and_quit_on_keypress(1))) {
|
||||
skip_timeout = true;
|
||||
print("\e[2K\r");
|
||||
print("\e[2K");
|
||||
term_double_buffer_flush();
|
||||
goto timeout_aborted;
|
||||
}
|
||||
|
@ -614,6 +616,10 @@ refresh:
|
|||
goto autoboot;
|
||||
}
|
||||
|
||||
set_cursor_pos(0, term_rows - 1);
|
||||
if (selected_menu_entry->comment != NULL)
|
||||
print("\e[32m%s", selected_menu_entry->comment);
|
||||
|
||||
term_double_buffer_flush();
|
||||
|
||||
for (;;) {
|
||||
|
|
|
@ -12,6 +12,8 @@ BACKDROP_COLOUR=008080
|
|||
|
||||
:Stivale2 Test
|
||||
|
||||
COMMENT=Test of the stivale2 boot protocol.
|
||||
|
||||
PROTOCOL=stivale2
|
||||
RESOLUTION=800x600
|
||||
KERNEL_PATH=boot:///boot/test.elf
|
||||
|
@ -22,13 +24,19 @@ MODULE_STRING=yooooo
|
|||
|
||||
:EFI Chainloading
|
||||
|
||||
COMMENT=Test EFI image chainloading.
|
||||
|
||||
PROTOCOL=chainload
|
||||
IMAGE_PATH=boot:///EFI/BOOT/BOOTX64.EFI
|
||||
|
||||
:+Legacy
|
||||
|
||||
COMMENT=Contains legacy entries.
|
||||
|
||||
::Stivale Test
|
||||
|
||||
COMMENT=Stivale1 test.
|
||||
|
||||
PROTOCOL=stivale
|
||||
KERNEL_PATH=boot:///boot/test.elf
|
||||
KERNEL_CMDLINE=Hi! This is an example!
|
||||
|
|
Loading…
Reference in New Issue