New style syncthing menu

This commit is contained in:
Bob Mottram 2018-05-24 13:33:44 +01:00
parent 6781dba015
commit c7d16657a6
1 changed files with 13 additions and 20 deletions

View File

@ -213,33 +213,26 @@ function run_client_syncthing {
SYNCTHING_CONFIG_FILE=~/.syncthingids SYNCTHING_CONFIG_FILE=~/.syncthingids
SYNCTHING_ID=$(cat ~/.syncthing-server-id) SYNCTHING_ID=$(cat ~/.syncthing-server-id)
W=(1 $"Show device ID for ${PROJECT_NAME}"
2 $"Add an ID for another machine or device"
3 $"Remove an ID for another machine or device"
4 $"Manually edit device IDs")
while true while true
do do
data=$(mktemp 2>/dev/null) # shellcheck disable=SC2068
dialog --backtitle $"Freedombone User Control Panel" \ 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)
--title $"File Synchronization" \
--radiolist $"Choose an operation:" 12 70 6 \ if [ ! "$selection" ]; then
1 $"Show device ID for ${PROJECT_NAME}" off \ break
2 $"Add an ID for another machine or device" off \ fi
3 $"Remove an ID for another machine or device" off \
4 $"Manually edit device IDs" off \ case $selection in
5 $"Back to main menu" on 2> "$data"
sel=$?
case $sel in
1) rm -f "$data"
break;;
255) rm -f "$data"
break;;
esac
case $(cat "$data") in
1) syncthing_show_id;; 1) syncthing_show_id;;
2) syncthing_add_id;; 2) syncthing_add_id;;
3) syncthing_remove_id;; 3) syncthing_remove_id;;
4) syncthing_manual_edit;; 4) syncthing_manual_edit;;
5) rm -f "$data"
break;;
esac esac
rm -f "$data"
done done
} }