mirror of
https://github.com/ventoy/Ventoy.git
synced 2024-12-25 06:35:59 -05:00
Make VTOY_TREE_VIEW_MENU_STYLE also control the browser menu style. (#1439)
This commit is contained in:
parent
1c3fcbdfe9
commit
62dc0033ad
@ -171,10 +171,20 @@ static int ventoy_browser_iterate_partition(struct grub_disk *disk, const grub_p
|
|||||||
|
|
||||||
fs->fs_label(dev, &Label);
|
fs->fs_label(dev, &Label);
|
||||||
|
|
||||||
|
if (g_tree_view_menu_style == 0)
|
||||||
|
{
|
||||||
grub_snprintf(title, sizeof(title), "%-10s (%s,%s%d) [%s] %s %s",
|
grub_snprintf(title, sizeof(title), "%-10s (%s,%s%d) [%s] %s %s",
|
||||||
"DISK", disk->name, partition->msdostype == 0xee ? "gpt" : "msdos",
|
"DISK", disk->name, partition->msdostype == 0xee ? "gpt" : "msdos",
|
||||||
partition->number + 1, (Label ? Label : ""), fs->name,
|
partition->number + 1, (Label ? Label : ""), fs->name,
|
||||||
grub_get_human_size(partition->len << disk->log_sector_size, GRUB_HUMAN_SIZE_SHORT));
|
grub_get_human_size(partition->len << disk->log_sector_size, GRUB_HUMAN_SIZE_SHORT));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
grub_snprintf(title, sizeof(title), "(%s,%s%d) [%s] %s %s",
|
||||||
|
disk->name, partition->msdostype == 0xee ? "gpt" : "msdos",
|
||||||
|
partition->number + 1, (Label ? Label : ""), fs->name,
|
||||||
|
grub_get_human_size(partition->len << disk->log_sector_size, GRUB_HUMAN_SIZE_SHORT));
|
||||||
|
}
|
||||||
|
|
||||||
if (ventoy_get_fs_type(fs->name) >= ventoy_fs_max)
|
if (ventoy_get_fs_type(fs->name) >= ventoy_fs_max)
|
||||||
{
|
{
|
||||||
@ -326,6 +336,9 @@ static int ventoy_browser_iterate_dir(const char *filename, const struct grub_di
|
|||||||
|
|
||||||
node->dir = 1;
|
node->dir = 1;
|
||||||
grub_strncpy(node->filename, filename, sizeof(node->filename));
|
grub_strncpy(node->filename, filename, sizeof(node->filename));
|
||||||
|
|
||||||
|
if (g_tree_view_menu_style == 0)
|
||||||
|
{
|
||||||
grub_snprintf(node->menuentry, sizeof(node->menuentry),
|
grub_snprintf(node->menuentry, sizeof(node->menuentry),
|
||||||
"menuentry \"%-10s [%s]\" --class=vtoydir {\n"
|
"menuentry \"%-10s [%s]\" --class=vtoydir {\n"
|
||||||
" vt_browser_dir %s 0x%lx \"%s/%s\"\n"
|
" vt_browser_dir %s 0x%lx \"%s/%s\"\n"
|
||||||
@ -333,6 +346,15 @@ static int ventoy_browser_iterate_dir(const char *filename, const struct grub_di
|
|||||||
"DIR", filename, g_menu_device, (ulong)g_menu_fs, g_menu_path_buf, filename);
|
"DIR", filename, g_menu_device, (ulong)g_menu_fs, g_menu_path_buf, filename);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
grub_snprintf(node->menuentry, sizeof(node->menuentry),
|
||||||
|
"menuentry \"[%s]\" --class=vtoydir {\n"
|
||||||
|
" vt_browser_dir %s 0x%lx \"%s/%s\"\n"
|
||||||
|
"}\n",
|
||||||
|
filename, g_menu_device, (ulong)g_menu_fs, g_menu_path_buf, filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
grub_uint64_t fsize = info->size;
|
grub_uint64_t fsize = info->size;
|
||||||
|
|
||||||
@ -363,6 +385,9 @@ static int ventoy_browser_iterate_dir(const char *filename, const struct grub_di
|
|||||||
|
|
||||||
node->dir = 0;
|
node->dir = 0;
|
||||||
grub_strncpy(node->filename, filename, sizeof(node->filename));
|
grub_strncpy(node->filename, filename, sizeof(node->filename));
|
||||||
|
|
||||||
|
if (g_tree_view_menu_style == 0)
|
||||||
|
{
|
||||||
grub_snprintf(node->menuentry, sizeof(node->menuentry),
|
grub_snprintf(node->menuentry, sizeof(node->menuentry),
|
||||||
"menuentry \"%-10s %s\" --class=%s {\n"
|
"menuentry \"%-10s %s\" --class=%s {\n"
|
||||||
" vt_set_fake_vlnk \"(%s)%s/%s\" %s %llu\n"
|
" vt_set_fake_vlnk \"(%s)%s/%s\" %s %llu\n"
|
||||||
@ -373,6 +398,19 @@ static int ventoy_browser_iterate_dir(const char *filename, const struct grub_di
|
|||||||
g_menu_device, g_menu_path_buf, filename, g_menu_prefix[type], (ulonglong)fsize,
|
g_menu_device, g_menu_path_buf, filename, g_menu_prefix[type], (ulonglong)fsize,
|
||||||
g_menu_prefix[type]);
|
g_menu_prefix[type]);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
grub_snprintf(node->menuentry, sizeof(node->menuentry),
|
||||||
|
"menuentry \"%s\" --class=%s {\n"
|
||||||
|
" vt_set_fake_vlnk \"(%s)%s/%s\" %s %llu\n"
|
||||||
|
" %s_common_menuentry\n"
|
||||||
|
" vt_reset_fake_vlnk\n"
|
||||||
|
"}\n",
|
||||||
|
filename, g_menu_class[type],
|
||||||
|
g_menu_device, g_menu_path_buf, filename, g_menu_prefix[type], (ulonglong)fsize,
|
||||||
|
g_menu_prefix[type]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
node->prev = NULL;
|
node->prev = NULL;
|
||||||
node->next = g_browser_list;
|
node->next = g_browser_list;
|
||||||
@ -434,8 +472,16 @@ grub_err_t ventoy_cmd_browser_dir(grub_extcmd_context_t ctxt, int argc, char **a
|
|||||||
}
|
}
|
||||||
grub_device_close(dev);
|
grub_device_close(dev);
|
||||||
|
|
||||||
|
if (g_tree_view_menu_style == 0)
|
||||||
|
{
|
||||||
browser_ssprintf(&mbuf, "menuentry \"%-10s [../]\" --class=\"vtoyret\" VTOY_RET {\n "
|
browser_ssprintf(&mbuf, "menuentry \"%-10s [../]\" --class=\"vtoyret\" VTOY_RET {\n "
|
||||||
" echo 'return ...' \n}\n", "<--");
|
" echo 'return ...' \n}\n", "<--");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
browser_ssprintf(&mbuf, "menuentry \"[../]\" --class=\"vtoyret\" VTOY_RET {\n "
|
||||||
|
" echo 'return ...' \n}\n");
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 1; i >= 0; i--)
|
for (i = 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
@ -493,8 +539,16 @@ grub_err_t ventoy_cmd_browser_disk(grub_extcmd_context_t ctxt, int argc, char **
|
|||||||
|
|
||||||
g_vtoy_dev = grub_env_get("vtoydev");
|
g_vtoy_dev = grub_env_get("vtoydev");
|
||||||
|
|
||||||
|
if (g_tree_view_menu_style == 0)
|
||||||
|
{
|
||||||
browser_ssprintf(&mbuf, "menuentry \"%-10s [Return]\" --class=\"vtoyret\" VTOY_RET {\n "
|
browser_ssprintf(&mbuf, "menuentry \"%-10s [Return]\" --class=\"vtoyret\" VTOY_RET {\n "
|
||||||
" echo 'return ...' \n}\n", "<--");
|
" echo 'return ...' \n}\n", "<--");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
browser_ssprintf(&mbuf, "menuentry \"[Return]\" --class=\"vtoyret\" VTOY_RET {\n "
|
||||||
|
" echo 'return ...' \n}\n");
|
||||||
|
}
|
||||||
|
|
||||||
grub_disk_dev_iterate(ventoy_browser_iterate_disk, &mbuf);
|
grub_disk_dev_iterate(ventoy_browser_iterate_disk, &mbuf);
|
||||||
|
|
||||||
|
@ -1187,6 +1187,7 @@ typedef struct browser_node
|
|||||||
struct browser_node *next;
|
struct browser_node *next;
|
||||||
}browser_node;
|
}browser_node;
|
||||||
|
|
||||||
|
extern int g_tree_view_menu_style;
|
||||||
extern int g_sort_case_sensitive;
|
extern int g_sort_case_sensitive;
|
||||||
extern int g_wimboot_enable;
|
extern int g_wimboot_enable;
|
||||||
extern int g_filt_dot_underscore_file;
|
extern int g_filt_dot_underscore_file;
|
||||||
|
Loading…
Reference in New Issue
Block a user