浏览代码

Selecting apps on the user control panel

Bob Mottram 7 年前
父节点
当前提交
6781dba015
共有 1 个文件被更改,包括 9 次插入16 次删除
  1. 9
    16
      src/freedombone-controlpanel-user

+ 9
- 16
src/freedombone-controlpanel-user 查看文件

812
 function menu_run_client_app {
812
 function menu_run_client_app {
813
     detect_installable_apps
813
     detect_installable_apps
814
 
814
 
815
-    applist=""
815
+    W=()
816
     appnames=()
816
     appnames=()
817
     n=1
817
     n=1
818
     app_index=0
818
     app_index=0
821
     do
821
     do
822
         if [[ ${APPS_INSTALLED[$app_index]} != "0" ]]; then
822
         if [[ ${APPS_INSTALLED[$app_index]} != "0" ]]; then
823
             if [[ $(function_exists "run_client_${a}") == "1" ]]; then
823
             if [[ $(function_exists "run_client_${a}") == "1" ]]; then
824
-                applist="$applist $n $a off"
824
+                W+=("$n" "$a")
825
                 n=$((n+1))
825
                 n=$((n+1))
826
                 appnames+=("$a")
826
                 appnames+=("$a")
827
             fi
827
             fi
831
     if [ $n -le 1 ]; then
831
     if [ $n -le 1 ]; then
832
         return
832
         return
833
     fi
833
     fi
834
-    backstr=$'Exit'
835
-    applist="$applist $n $backstr on"
836
-    appnames+=("Exit")
837
 
834
 
838
     # shellcheck disable=SC2086
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
     fi
840
     fi
841
+
842
+    app_index=$((selection-1))
843
+    chosen_app=${appnames[$app_index]}
844
+    "run_client_${chosen_app}"
852
 }
845
 }
853
 
846
 
854
 function show_your_email_address {
847
 function show_your_email_address {