Skip to content

Commit

Permalink
changes to keep Yad compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
vaisarger committed Jun 5, 2020
1 parent f9a109b commit 5cb6396
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 48 deletions.
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ Since 8.0.0 version, project is housed at github ( https://github.com/BashGui ).
Credits.

Thanks to Bash, Yad, Gtkdialog, Xdialog, Kdialog, Zenity, Cdialog, and Whiptail authors, this library was nothing without their work. Many thanks.
Thanks to Frank Dietermann for suggestion though to make EBG "posix compliant" (vers. 11.X.X )
Thanks to Frank Dietermann for suggestion though to make EBG "posix compliant" (since vers. 11.X.X )
Thanks to Jose Joao Dias de Almeida for the makefile tip.
Thanks to Chris "cgat" for his many ideas and suggestions that lead to version's "5.X.X" EasyBashGUI "revolution".
Thanks to Davide Depau for his tests and support, and his effort to make EasyBashGUI Debian policy compliant, and finally for his man page.
Expand Down
26 changes: 20 additions & 6 deletions lib/easybashgui.lib
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#
#########################
#
# Copyright (C) 2019 Vittorio Cagnetta
# Copyright (C) 2020 Vittorio Cagnetta
#
# Author: Vittorio Cagnetta <[email protected]>
#
Expand All @@ -35,7 +35,7 @@
#####################################
#####################################
#
LIB_VERSION="12.0.3"
LIB_VERSION="12.0.4"
LIB_NAME="easybashgui.lib"
LIB_URL="https://github.com/BashGui/easybashgui"
LIB_AUTHOR="Vittorio Cagnetta"
Expand Down Expand Up @@ -85,6 +85,15 @@ height=378
#
##
#
typing_tac="$(type 'tac' 2> /dev/null )"
[ ${#typing_tac} -eq 0 ] && shopt -s expand_aliases && alias tac="sed '1'\!'G;h;$'\!'d'"
: tac
#
typing_seq="$(type 'seq' 2> /dev/null )"
[ ${#typing_seq} -eq 0 ] && seq() { for ((index=${1}; index<=${2}; index++)); do echo "${index}"; done; } && export -f seq
#
##
#
# gsed...
for word in sed gsed
do
Expand All @@ -93,7 +102,7 @@ for word in sed gsed
done
[ "${mascotte}" = "Beastie" ] && : #later we'll check for gsed binary...
[ "${mascotte}" = "Tux" ] && shopt -s expand_aliases && alias gsed=sed #gsed is no more a function...
typing_gsed="$(type "gsed" 2> /dev/null )"
typing_gsed="$(type 'gsed' 2> /dev/null )"
if [ ${#typing_gsed} -eq 0 ]
then
[ "${mascotte}" = "Beastie" ] && echo -e "\n\n\n\nYou need to install \"gsed\" ( GNU Sed ) port/package to use ${LIB_NAME}...\nSorry :(\n\n\n\n" 1>&2
Expand Down Expand Up @@ -3064,7 +3073,10 @@ if [ "${mode}" = "yad" ]
testo="${@}"
#
testo_yad="$(echo "${testo}" | tr -d '<>' )"
yes | \
#
yess() { while : ; do echo 'y' ; sleep 0.1 ; done ; }
#yes | \
yess | \
${dialogo} --title "${supertitle:-EasyBashGUI}: please wait" --progress --pulsate --auto-kill --text "$(echo -e "${testo_yad}" )" ${dimensione_finestra} &>/dev/null &
#
export wait_for__PID="${!}"
Expand Down Expand Up @@ -3387,7 +3399,8 @@ if [ "${mode}" = "yad" ]
dir="${HOME}/"
fi
#
fselect="--file-selection"
[ $(yad --help | grep "\-\-file\-selection" | wc -c ) -gt 0 ] && fselect="--file-selection" || fselect="--file"
#
dim_finestra="${dimensione_finestra}"
eval ${dialogo} --title \"${supertitle:-EasyBashGUI}: file select\" ${fselect} --filename \"${dir}\" ${dim_finestra} 2> /dev/null 1> "${dir_tmp}/${file_tmp}"
#
Expand Down Expand Up @@ -3754,7 +3767,8 @@ if [ "${mode}" = "yad" ]
dir="${HOME}/"
fi
#
dselect="--file-selection --directory"
[ $(yad --help | grep "\-\-file\-selection" | wc -c ) -gt 0 ] && dselect="--file-selection --directory" || dselect="--file --directory"
#
dim_finestra="${dimensione_finestra}"
eval ${dialogo} --title \"${supertitle:-EasyBashGUI}: dir. select\" ${dselect} --filename \"${dir}\" ${dim_finestra} 2> /dev/null 1> "${dir_tmp}/${file_tmp}"
#exit_if_user_closes_window
Expand Down
41 changes: 12 additions & 29 deletions lib/easybashlib
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# easybashlib - EasyBash Library...
#
# Hint: If you are just using a random editor, try Geany.
#
# For more lib modules and improvement ideas see:
# http://dberkholz.com/2011/04/07/bash-shell-scripting-libraries/

Expand Down Expand Up @@ -179,8 +177,6 @@ function eb_error_output()
#####################




function eb_kill_process_tree_of_pid() {
# Grows a process tree that can kill an existing process tree beginning with
# the given PID as parent.
Expand Down Expand Up @@ -231,15 +227,11 @@ function eb_kill_process_tree_of_pid() {
fi
done


}







# Define a mechanism for automatic clean up on exit, based upon the idea
# http://www.linuxjournal.com/content/use-bash-trap-statement-cleanup-temporary-files
#
Expand Down Expand Up @@ -297,15 +289,11 @@ ebg_add_on_exit()






###############
# Directories #
###############



# determine eb_conf_dir
if [ "${USERPROFILE:-undefined}" = undefined ]
then
Expand Down Expand Up @@ -351,7 +339,6 @@ eb_debug_output "eb_log_dir is set to $eb_log_dir"




# determine eb_persistence_dir
if [ "${USERPROFILE:-undefined}" = undefined ]
then
Expand Down Expand Up @@ -440,14 +427,11 @@ fi





##########
# Checks #
##########



function eb_gen_check_code()
# Generates code to check the tests given as parameters (all tests if none was specified).
# Usefull to run selections of tests in context as needed.
Expand Down Expand Up @@ -533,29 +517,28 @@ function eb_check_local()
eb_map() {
#parameters: action, storage_type, key, value, process_name

[ "$#" -lt 2 ] && exit 1
local action="$1"
local storage_type="$2"
local mapname="$3"
local key="$4"
local value="$5"
[ "${#}" -lt 2 ] && exit 1
local action="${1}"
local storage_type="${2}"
local mapname="${3}"
local key="${4}"
local value="${5}"
local process_name="${6:-${eb_runtime_invoke_name}}"
local mapdir

if [ "$storage_type" = "persistent" ]
then
if [ "${storage_type}" = "persistent" ]
then
mapdir="${eb_persistence_basedir}/${process_name}/eb_key-value-maps"
else
mapdir="$(eb_get_state_dir ${process_name})/eb_key-value-maps"
fi

if [ "$action" = "put" ]
then
if [ "${action}" = "put" ]
then
[ -d "${mapdir}/${mapname}" ] || mkdir -p "${mapdir}/${mapname}"
echo $value >"${mapdir}/${mapname}/${key}"

elif [ "$action" = "get" ]
then
elif [ "${action}" = "get" ]
then
cat "${mapdir}/${mapname}/${key}"
fi
}
Expand Down
2 changes: 1 addition & 1 deletion makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#EBGlib=$(wildcard easybashgui_[0-9].[0-9].[0-9])
VERSION=12.0.3
VERSION=12.0.4

#cartelle di destinazione
DESTDIR ?= ""
Expand Down
7 changes: 2 additions & 5 deletions src/easybashgui
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#
#########################
#
# Copyright (C) 2019 Vittorio Cagnetta
# Copyright (C) 2020 Vittorio Cagnetta
#
# Author: Vittorio Cagnetta <[email protected]>
# Author: Christian ? <https://launchpad.net/~cgat-1>
Expand Down Expand Up @@ -74,12 +74,9 @@
# Improvement thanks to Stefano Borini's answer at
# http://stackoverflow.com/questions/78497/design-patterns-or-best-practices-for-shell-scripts
#
# TODO
# Load newest version of module if there are several available?
# something like if [ -e $(eb_incl__absolute_path)/$module_*.*.* ] ?
#
###################################################################
MODULE_VERSION="12.0.3"
MODULE_VERSION="12.0.4"
MODULE_NAME="easybashgui"
libexec_dir="/usr/lib/easybashgui"
###################################################################
Expand Down
7 changes: 2 additions & 5 deletions src/easybashgui-debug
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#
#########################
#
# Copyright (C) 2019 Vittorio Cagnetta
# Copyright (C) 2020 Vittorio Cagnetta
#
# Author: Vittorio Cagnetta <[email protected]>
# Author: Christian ? <https://launchpad.net/~cgat-1>
Expand Down Expand Up @@ -74,12 +74,9 @@
# Improvement thanks to Stefano Borini's answer at
# http://stackoverflow.com/questions/78497/design-patterns-or-best-practices-for-shell-scripts
#
# TODO
# Load newest version of module if there are several available?
# something like if [ -e $(eb_incl__absolute_path)/$module_*.*.* ] ?
#
###################################################################
MODULE_VERSION="12.0.3"
MODULE_VERSION="12.0.4"
MODULE_NAME="easybashgui-debug"
###################################################################
#
Expand Down
2 changes: 1 addition & 1 deletion src/easydialog-legacy
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
#########################
#
# Copyright (C) 2013 Vittorio Cagnetta
# Copyright (C) 2020 Vittorio Cagnetta
#
# Author: Vittorio Cagnetta <[email protected]>
#
Expand Down

0 comments on commit 5cb6396

Please sign in to comment.