Browse Source

New style syncthing menu

Bob Mottram 6 years ago
parent
commit
c7d16657a6
1 changed files with 13 additions and 20 deletions
  1. 13
    20
      src/freedombone-app-syncthing

+ 13
- 20
src/freedombone-app-syncthing View File

@@ -213,33 +213,26 @@ function run_client_syncthing {
213 213
     SYNCTHING_CONFIG_FILE=~/.syncthingids
214 214
     SYNCTHING_ID=$(cat ~/.syncthing-server-id)
215 215
 
216
+    W=(1 $"Show device ID for ${PROJECT_NAME}"
217
+       2 $"Add an ID for another machine or device"
218
+       3 $"Remove an ID for another machine or device"
219
+       4 $"Manually edit device IDs")
220
+
216 221
     while true
217 222
     do
218
-        data=$(mktemp 2>/dev/null)
219
-        dialog --backtitle $"Freedombone User Control Panel" \
220
-               --title $"File Synchronization" \
221
-               --radiolist $"Choose an operation:" 12 70 6 \
222
-               1 $"Show device ID for ${PROJECT_NAME}" off \
223
-               2 $"Add an ID for another machine or device" off \
224
-               3 $"Remove an ID for another machine or device" off \
225
-               4 $"Manually edit device IDs" off \
226
-               5 $"Back to main menu" on 2> "$data"
227
-        sel=$?
228
-        case $sel in
229
-            1) rm -f "$data"
230
-               break;;
231
-            255) rm -f "$data"
232
-                 break;;
233
-        esac
234
-        case $(cat "$data") in
223
+        # shellcheck disable=SC2068
224
+        selection=$(dialog --backtitle $"Freedombone User Control Panel" --title $"File Synchronization" --menu $"Choose an operation, or ESC for main menu:" 12 70 6 "${W[@]}" 3>&2 2>&1 1>&3)
225
+
226
+        if [ ! "$selection" ]; then
227
+           break
228
+        fi
229
+
230
+        case $selection in
235 231
             1) syncthing_show_id;;
236 232
             2) syncthing_add_id;;
237 233
             3) syncthing_remove_id;;
238 234
             4) syncthing_manual_edit;;
239
-            5) rm -f "$data"
240
-               break;;
241 235
         esac
242
-        rm -f "$data"
243 236
     done
244 237
 }
245 238