summaryrefslogtreecommitdiff
path: root/package/config/menu.c
diff options
context:
space:
mode:
authorPeter Korsgaard <jacmet@sunsite.dk>2011-02-02 14:49:50 +0100
committerPeter Korsgaard <jacmet@sunsite.dk>2011-02-02 15:54:50 +0100
commita538d4057e3add76889270ec097572223b11ba07 (patch)
tree59e2430e7b40d13e086c2a82004a474c86a8cab4 /package/config/menu.c
parent72daa122b6a4a9562109299d0b747c71aac1e483 (diff)
package/config: rebase against 2.6.37
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Diffstat (limited to 'package/config/menu.c')
-rw-r--r--package/config/menu.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/package/config/menu.c b/package/config/menu.c
index 11afee2bc..1deca3c92 100644
--- a/package/config/menu.c
+++ b/package/config/menu.c
@@ -140,6 +140,20 @@ struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *e
}
if (current_entry->prompt && current_entry != &rootmenu)
prop_warn(prop, "prompt redefined");
+
+ /* Apply all upper menus' visibilities to actual prompts. */
+ if(type == P_PROMPT) {
+ struct menu *menu = current_entry;
+
+ while ((menu = menu->parent) != NULL) {
+ if (!menu->visibility)
+ continue;
+ prop->visible.expr
+ = expr_alloc_and(prop->visible.expr,
+ menu->visibility);
+ }
+ }
+
current_entry->prompt = prop;
}
prop->text = prompt;
@@ -152,6 +166,12 @@ struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr
return menu_add_prop(type, prompt, NULL, dep);
}
+void menu_add_visibility(struct expr *expr)
+{
+ current_entry->visibility = expr_alloc_and(current_entry->visibility,
+ expr);
+}
+
void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep)
{
menu_add_prop(type, NULL, expr, dep);
@@ -410,6 +430,11 @@ bool menu_is_visible(struct menu *menu)
if (!menu->prompt)
return false;
+ if (menu->visibility) {
+ if (expr_calc_value(menu->visibility) == no)
+ return no;
+ }
+
sym = menu->sym;
if (sym) {
sym_calc_value(sym);