From 6781dba015d0e2418ebff26383cd19ec051dc24e Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 24 May 2018 13:17:11 +0100 Subject: [PATCH] Selecting apps on the user control panel --- src/freedombone-controlpanel-user | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/src/freedombone-controlpanel-user b/src/freedombone-controlpanel-user index f78ee5f2..6ebc59bb 100755 --- a/src/freedombone-controlpanel-user +++ b/src/freedombone-controlpanel-user @@ -812,7 +812,7 @@ function sign_keys { function menu_run_client_app { detect_installable_apps - applist="" + W=() appnames=() n=1 app_index=0 @@ -821,7 +821,7 @@ function menu_run_client_app { do if [[ ${APPS_INSTALLED[$app_index]} != "0" ]]; then if [[ $(function_exists "run_client_${a}") == "1" ]]; then - applist="$applist $n $a off" + W+=("$n" "$a") n=$((n+1)) appnames+=("$a") fi @@ -831,24 +831,17 @@ function menu_run_client_app { if [ $n -le 1 ]; then return fi - backstr=$'Exit' - applist="$applist $n $backstr on" - appnames+=("Exit") # shellcheck disable=SC2086 - choice=$(dialog --stdout --backtitle $"Freedombone" \ - --title $"Run an App" \ - --radiolist $'Choose:' \ - 16 40 20 $applist) + selection=$(dialog --backtitle $"Freedombone" --title $"Run an App" --menu $"Choose an operation, or ESC for main menu:" 16 70 20 "${W[@]}" 3>&2 2>&1 1>&3) - # shellcheck disable=SC2181 - if [ $? -eq 0 ]; then - app_index=$((choice-1)) - chosen_app=${appnames[$app_index]} - if [[ $chosen_app != "Exit" ]]; then - "run_client_${chosen_app}" - fi + if [ ! "$selection" ]; then + return fi + + app_index=$((selection-1)) + chosen_app=${appnames[$app_index]} + "run_client_${chosen_app}" } function show_your_email_address {