gui: Make _gsu_node_name_pattern private.
[gsu.git] / gui
diff --git a/gui b/gui
index 72717a1..db81f7f 100644 (file)
--- a/gui
+++ b/gui
@@ -6,7 +6,7 @@ if [[ "$(type -t _gsu_setup)" != "function" ]]; then
        _gsu_setup
 fi
 
-export GSU_NODE_NAME_PATTERN='[a-zA-Z_]'
+_gsu_node_name_pattern='[a-zA-Z_]'
 
 _get_geometry()
 {
@@ -22,50 +22,6 @@ _get_geometry()
        result="$y $x"
 }
 
-gsu_infobox()
-{
-       _get_geometry
-       dialog --infobox "$1" $result
-}
-
-gsu_checklist_all_on()
-{
-       local header="$1"
-       local items="$2"
-       local i state opts num=0
-
-       _get_geometry
-       ops="$result 16"
-       for i in $items; do
-               let num++
-               opts+=" $i $num on"
-       done
-       result=$(dialog --checklist "$header" $opts 3>&1 1>&2 2>&3 3>&-)
-       ret="$?"
-}
-
-gsu_radiolist()
-{
-       local header="$1"
-       local selected_item="$2"
-       local items="$3"
-       local i state ops num=0
-
-       _get_geometry
-       ops="$result 16"
-       for i in $items; do
-               let num++
-               if [[ "$i" == "$selected_item" ]]; then
-                       state="on"
-               else
-                       state="off"
-               fi
-               ops+=" $i $num $state"
-       done
-       result=$(dialog --radiolist "$header" $ops 3>&1 1>&2 2>&3 3>&-)
-       ret="$?"
-}
-
 gsu_inputbox()
 {
        local g text="$1" init="$2"
@@ -98,37 +54,7 @@ gsu_msgbox()
        rm -f "$tmp"
 }
 
-gsu_cmd_output_box()
-{
-       local tmp="$(mktemp)"
-
-       if (($? != 0)); then
-               dialog --msgbox "mktemp error" 0 0
-               return
-       fi
-       $@ > "$tmp" 2>&1
-       echo "exit code: $?" >> "$tmp"
-       gsu_textbox "$tmp"
-       rm -f "$tmp"
-}
-
-gsu_yesno()
-{
-       local text="$1"
-
-       _get_geometry
-       dialog --yesno "$text" $result
-       ret=$?
-       if (($ret == 0)); then
-               result="yes"
-       elif (($ret == 1)); then
-               result="no"
-       else
-               result=
-       fi
-}
-
-gsu_menu()
+_gsu_menu()
 {
        local header="${1:-root}"
        local items="$2"
@@ -146,7 +72,7 @@ gsu_menu()
 
 _get_level()
 {
-       local tmp="${1%%$GSU_NODE_NAME_PATTERN*}"
+       local tmp="${1%%$_gsu_node_name_pattern*}"
        result="${#tmp}"
 }
 
@@ -164,7 +90,7 @@ _get_subtree()
 
        #echo "line: $line_num, root: $root, indent level: $level"
        result="$(sed -e "1,${line_num}d;" <<< "$tree" \
-               | sed -e "/^$TAB\{1,$level\}$GSU_NODE_NAME_PATTERN/,\$d" \
+               | sed -e "/^$TAB\{1,$level\}$_gsu_node_name_pattern/,\$d" \
                | sed -e "/^$TAB\{$(($level + 2))\}/d")"
        ret="$level"
 }
@@ -173,7 +99,7 @@ _get_root_nodes()
 {
        local tree="$1" TAB='   '
 
-       result="$(grep "^${TAB}${GSU_NODE_NAME_PATTERN}" <<< "$tree")"
+       result="$(grep "^${TAB}${_gsu_node_name_pattern}" <<< "$tree")"
 }
 
 _browse()
@@ -182,7 +108,7 @@ _browse()
        local tree="$2" subtree="$3"
 
        while :; do
-               gsu_menu "$header" "$subtree"
+               _gsu_menu "$header" "$subtree"
                (($ret != 0)) && return
                [[ -z "$result" ]] && return
                if [[ "${result%/}" != "$result" ]]; then