X-Git-Url: https://jxself.org/git/?p=carl9170fw.git;a=blobdiff_plain;f=config%2Fmenu.c;h=7e233a6ca64ef7faf1bc9390ec89cb90ccef2d98;hp=fd3f0180e08fbafb537e128c9e46641288c68774;hb=f0c03963adbc21063171d0e0bc70ac78f554f605;hpb=3da4505c135382c2eb4d54c6c1a25e10884ad174 diff --git a/config/menu.c b/config/menu.c index fd3f018..7e233a6 100644 --- a/config/menu.c +++ b/config/menu.c @@ -443,6 +443,22 @@ bool menu_has_prompt(struct menu *menu) return true; } +/* + * Determine if a menu is empty. + * A menu is considered empty if it contains no or only + * invisible entries. + */ +bool menu_is_empty(struct menu *menu) +{ + struct menu *child; + + for (child = menu->list; child; child = child->next) { + if (menu_is_visible(child)) + return(false); + } + return(true); +} + bool menu_is_visible(struct menu *menu) { struct menu *child;