Browse Source

Edith configuration menu style

Bob Mottram 7 years ago
parent
commit
2cbcf7b143
1 changed files with 11 additions and 18 deletions
  1. 11
    18
      src/freedombone-app-edith

+ 11
- 18
src/freedombone-app-edith View File

@@ -131,29 +131,22 @@ function edith_browse {
131 131
 }
132 132
 
133 133
 function configure_interactive_edith {
134
+    W=(1 $"Enable login"
135
+       2 $"Browse notes")
136
+
134 137
     while true
135 138
     do
136
-        data=$(mktemp 2>/dev/null)
137
-        dialog --backtitle $"Freedombone Control Panel" \
138
-               --title $"Edith" \
139
-               --radiolist $"Choose an operation:" 10 50 3 \
140
-               1 $"Enable login" off \
141
-               2 $"Browse notes" off \
142
-               3 $"Exit" on 2> "$data"
143
-        sel=$?
144
-        case $sel in
145
-            1) rm -f "$data"
146
-               break;;
147
-            255) rm -f "$data"
148
-                 break;;
149
-        esac
150
-        case $(cat "$data") in
139
+        # shellcheck disable=SC2068
140
+        selection=$(dialog --backtitle $"Freedombone Administrator Control Panel" --title $"Edith" --menu $"Choose an operation, or ESC to exit:" 10 60 2 "${W[@]}" 3>&2 2>&1 1>&3)
141
+
142
+        if [ ! "$selection" ]; then
143
+            break
144
+        fi
145
+
146
+        case $selection in
151 147
             1) edith_enable_login;;
152 148
             2) edith_browse;;
153
-            3) rm -f "$data"
154
-               break;;
155 149
         esac
156
-        rm -f "$data"
157 150
     done
158 151
 }
159 152