X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=config%2Fmenu.c;h=7e233a6ca64ef7faf1bc9390ec89cb90ccef2d98;hb=f0c03963adbc21063171d0e0bc70ac78f554f605;hp=fd3f0180e08fbafb537e128c9e46641288c68774;hpb=6cbac37e1eefd4d5f75879136cff03cdfd6c2e01;p=carl9170fw.git 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;