From 875e6c8e0d8bf5815b8598f26c7a74af01ccd8e3 Mon Sep 17 00:00:00 2001 From: Pierre-Alexandre Meyer Date: Wed, 18 Nov 2009 20:25:29 -0800 Subject: hdt: fix double lines in the menu Ralf Carl reports some UI glitches in the summary menu (unnecessary line separator at the bottom). This patch rewrites the separator logic. Signed-off-by: Pierre-Alexandre Meyer --- com32/hdt/hdt-menu-summary.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'com32/hdt/hdt-menu-summary.c') diff --git a/com32/hdt/hdt-menu-summary.c b/com32/hdt/hdt-menu-summary.c index 8378c1b8..eba01280 100644 --- a/com32/hdt/hdt-menu-summary.c +++ b/com32/hdt/hdt-menu-summary.c @@ -96,9 +96,10 @@ void compute_summarymenu(struct s_my_menu *menu, struct s_hardware *hardware) add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0); menu->items_count++; - add_item("", "", OPT_SEP, "", 0); /*if type 17 is available */ if (hardware->dmi.memory_count>0) { + add_item("", "", OPT_SEP, "", 0); + for (int i = 0; i < hardware->dmi.memory_count; i++) { if (hardware->dmi.memory[i].filled == true) { memset(bank_number, 0, sizeof(bank_number)); @@ -125,6 +126,8 @@ void compute_summarymenu(struct s_my_menu *menu, struct s_hardware *hardware) } } } else if (hardware->dmi.memory_module_count>0) { + add_item("", "", OPT_SEP, "", 0); + /* Let's use type 6 as a fallback of type 17*/ for (int i = 0; i < hardware->dmi.memory_module_count; i++) { if (hardware->dmi.memory_module[i].filled == true) { @@ -149,10 +152,10 @@ void compute_summarymenu(struct s_my_menu *menu, struct s_hardware *hardware) } } } - - add_item("", "", OPT_SEP, "", 0); } + add_item("", "", OPT_SEP, "", 0); + snprintf(buffer, sizeof buffer, "Nb PCI Devices: %d", hardware->nb_pci_devices); snprintf(statbuffer, sizeof statbuffer, "Number of PCI Devices: %d", @@ -160,9 +163,9 @@ void compute_summarymenu(struct s_my_menu *menu, struct s_hardware *hardware) add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0); menu->items_count++; - add_item("", "", OPT_SEP, "", 0); - if (hardware->is_pxe_valid == true) { + add_item("", "", OPT_SEP, "", 0); + struct s_pxe *p = &hardware->pxe; snprintf(buffer, sizeof buffer, "PXE MAC Address: %s", @@ -180,11 +183,11 @@ void compute_summarymenu(struct s_my_menu *menu, struct s_hardware *hardware) p->ip_addr[1], p->ip_addr[2], p->ip_addr[3]); add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0); menu->items_count++; - - add_item("", "", OPT_SEP, "", 0); } if (hardware->modules_pcimap_return_code != -ENOMODULESPCIMAP) { + add_item("", "", OPT_SEP, "", 0); + bool kmod = false; struct pci_device *pci_device; char kernel_modules[LINUX_KERNEL_MODULE_SIZE * @@ -226,8 +229,6 @@ void compute_summarymenu(struct s_my_menu *menu, struct s_hardware *hardware) kmod = true; } } - if (kmod == true) - add_item("", "", OPT_SEP, "", 0); } printf("MENU: Summary menu done (%d items)\n", menu->items_count); -- cgit v1.2.1