From 7a0b92c5deb2b235a631cf6043f70ea4e7111bb7 Mon Sep 17 00:00:00 2001
From: Carmelo Pellegrino <carmelo.pellegrino@gmail.com>
Date: Thu, 21 May 2015 17:37:01 +0200
Subject: [PATCH] run setups list read from file

---
 patch-control.sh | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/patch-control.sh b/patch-control.sh
index 78d90dd..a60b560 100644
--- a/patch-control.sh
+++ b/patch-control.sh
@@ -37,16 +37,23 @@ function on_exit() {
   unset pid
 }
 
-function createList() {
+function get_run_setup_file() {
   local LIST
-  local file
+  local line
 
-  for file in *.detectorfile; do
-    LIST=(${LIST[*]} "FALSE" ${file})
-  done
-  unset file
+  while IFS=';' read -ra line; do
+    LIST+=("FALSE" "${line[@]}")
+  done < pc.cfg
 
-  echo ${LIST[*]}
+  echo $(zenity --title "Run Setup Selector" \
+                   --list \
+                   --text "Select one of the following Run Setups:" \
+                   --radiolist \
+                   --column="Selection" \
+                   --column="Run Setup file" \
+                   --column="Run Setup name" \
+                   --column="Description" \
+                   --hide-column=2 "${LIST[@]}")
 }
 
 function dm_driver() {
@@ -95,13 +102,7 @@ while [ 1 ]; do
 
   # Ask for the run setup
 
-  rs_file=`zenity --title "Run Setup Selector" \
-                   --list \
-                   --text "Select one of the following Run Setups:" \
-                   --radiolist \
-                   --column="Selection" \
-                   --column="Run Setup file" \
-                   $(createList ${folder})`
+  rs_file=`get_run_setup_file`
 
   if [ -z "${rs_file}" ]; then
     zenity --error --text="No Run Setup file selected, aborting"
-- 
GitLab