ソースを参照

Selecting apps on the user control panel

Bob Mottram 6 年 前
コミット
6781dba015
共有1 個のファイルを変更した9 個の追加16 個の削除を含む
  1. 9
    16
      src/freedombone-controlpanel-user

+ 9
- 16
src/freedombone-controlpanel-user ファイルの表示

@@ -812,7 +812,7 @@ function sign_keys {
812 812
 function menu_run_client_app {
813 813
     detect_installable_apps
814 814
 
815
-    applist=""
815
+    W=()
816 816
     appnames=()
817 817
     n=1
818 818
     app_index=0
@@ -821,7 +821,7 @@ function menu_run_client_app {
821 821
     do
822 822
         if [[ ${APPS_INSTALLED[$app_index]} != "0" ]]; then
823 823
             if [[ $(function_exists "run_client_${a}") == "1" ]]; then
824
-                applist="$applist $n $a off"
824
+                W+=("$n" "$a")
825 825
                 n=$((n+1))
826 826
                 appnames+=("$a")
827 827
             fi
@@ -831,24 +831,17 @@ function menu_run_client_app {
831 831
     if [ $n -le 1 ]; then
832 832
         return
833 833
     fi
834
-    backstr=$'Exit'
835
-    applist="$applist $n $backstr on"
836
-    appnames+=("Exit")
837 834
 
838 835
     # shellcheck disable=SC2086
839
-    choice=$(dialog --stdout --backtitle $"Freedombone" \
840
-                     --title $"Run an App" \
841
-                     --radiolist $'Choose:' \
842
-                     16 40 20 $applist)
836
+    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)
843 837
 
844
-    # shellcheck disable=SC2181
845
-    if [ $? -eq 0 ]; then
846
-        app_index=$((choice-1))
847
-        chosen_app=${appnames[$app_index]}
848
-        if [[ $chosen_app != "Exit" ]]; then
849
-            "run_client_${chosen_app}"
850
-        fi
838
+    if [ ! "$selection" ]; then
839
+        return
851 840
     fi
841
+
842
+    app_index=$((selection-1))
843
+    chosen_app=${appnames[$app_index]}
844
+    "run_client_${chosen_app}"
852 845
 }
853 846
 
854 847
 function show_your_email_address {