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_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
do
data=$(mktemp 2>/dev/null)
dialog --backtitle $"Freedombone User Control Panel" \
--title $"File Synchronization" \
--radiolist $"Choose an operation:" 12 70 6 \
1 $"Show device ID for ${PROJECT_NAME}" off \
2 $"Add an ID for another machine or device" off \
3 $"Remove an ID for another machine or device" off \
4 $"Manually edit device IDs" off \
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
# shellcheck disable=SC2068
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)
if [ ! "$selection" ]; then
break
fi
case $selection in
1) syncthing_show_id;;
2) syncthing_add_id;;
3) syncthing_remove_id;;
4) syncthing_manual_edit;;
5) rm -f "$data"
break;;
esac
rm -f "$data"
done
}