MCPcopy Create free account
hub / github.com/Entware/Entware / conf_choice

Function conf_choice

scripts/config/mconf.c:685–754  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

683}
684
685static void conf_choice(struct menu *menu)
686{
687 const char *prompt = menu_get_prompt(menu);
688 struct menu *child;
689 struct symbol *active;
690 struct property *prop;
691
692 active = sym_get_choice_value(menu->sym);
693 while (1) {
694 int res;
695 int selected;
696 item_reset();
697
698 current_menu = menu;
699 for (child = menu->list; child; child = child->next) {
700 if (!menu_is_visible(child))
701 continue;
702 if (child->sym)
703 item_make("%s", menu_get_prompt(child));
704 else {
705 item_make("*** %s ***", menu_get_prompt(child));
706 item_set_tag(':');
707 }
708 item_set_data(child);
709 if (child->sym == active)
710 item_set_selected(1);
711 if (child->sym == sym_get_choice_value(menu->sym))
712 item_set_tag('X');
713 }
714 dialog_clear();
715 res = dialog_checklist(prompt ? prompt : "Main Menu",
716 radiolist_instructions,
717 MENUBOX_HEIGTH_MIN,
718 MENUBOX_WIDTH_MIN,
719 CHECKLIST_HEIGTH_MIN);
720 selected = item_activate_selected();
721 switch (res) {
722 case 0:
723 if (selected) {
724 child = item_data();
725 if (!child->sym)
726 break;
727
728 if (sym_get_tristate_value(child->sym) != yes) {
729 for_all_properties(menu->sym, prop, P_RESET) {
730 if (expr_calc_value(prop->visible.expr) == no)
731 continue;
732
733 conf_reset(S_DEF_USER);
734 break;
735 }
736 }
737 sym_set_tristate_value(child->sym, yes);
738 }
739 return;
740 case 1:
741 if (selected) {
742 child = item_data();

Callers 1

confFunction · 0.70

Calls 15

menu_get_promptFunction · 0.85
sym_get_choice_valueFunction · 0.85
item_resetFunction · 0.85
menu_is_visibleFunction · 0.85
item_set_tagFunction · 0.85
item_set_dataFunction · 0.85
item_set_selectedFunction · 0.85
dialog_clearFunction · 0.85
dialog_checklistFunction · 0.85
item_activate_selectedFunction · 0.85
sym_get_tristate_valueFunction · 0.85
expr_calc_valueFunction · 0.85

Tested by

no test coverage detected