Commit 5f33e36f authored by Vladislav's avatar Vladislav

Added print_wrapped

parent 6fce4820
......@@ -18,6 +18,27 @@ export -f print_ok
print_var () { for vp in $@ ; do print_info "${vp}=${!vp}" ; done ;}
export -f print_var
print_wrapped () {
local text="$1"
local a="0"
local b="$2"
local c="$3"
if [[ -n "$c" ]] ; then
if (( ${#text} > b )); then
echo "${text:a:b}${c}"
else
echo "$text"
fi
else
while (( a < ${#text} )) ; do
echo "${text:a:b}"
((a+=b))
done
fi
}
export -f print_wrapped
check_variables () { [[ -z ${!1} ]] && export $1="$2" ;}
add_to_var () {
......@@ -5157,13 +5178,16 @@ portwine_missing_shortcut () {
"${pw_yad}" --title="$(gettext "Error")" --form \
--window-icon "$PW_GUI_ICON_PATH/portproton.svg" --fixed \
--image "$PW_GUI_ICON_PATH/error.svg" \
--text "\n$(gettext "Could not find the file:")\n${portwine_exe}\n\n$(gettext "ATTENTION:\nIf you forgot to mount the disk with the running application, click CANCEL!")\n" \
--text "\n$(gettext "Could not find the file:")\n$(print_wrapped "${portwine_exe}" "50")\n\n$(gettext "ATTENTION:\nIf you forgot to mount the disk with the running application, click CANCEL!")\n" \
--button="$(gettext "DELETE SHORTCUT")"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE.png":0 \
--button="$(gettext "CANCEL")"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE.png":1
if [[ $? -eq "0" ]] ; then
portwine_delete_shortcut
fi
exit 0
if [[ -n "$TAB_MAIN_MENU" ]]
then restart_pp
else exit 0
fi
}
# GUI WINETRICKS | GUI PREFIX MANAGER
......
......@@ -52,7 +52,7 @@ then
elif [[ "$1" == *.[Ee][Xx][Ee] || "$1" == *.[Bb][Aa][Tt] || "$1" == *.[Mm][Ss][Ii] || "$1" == *.[Rr][Ee][Gg] ]]
then
portwine_exe="$1"
MISSING_DESKTOP_FILE=1
MISSING_DESKTOP_FILE="1"
fi
export portwine_exe
......@@ -404,7 +404,7 @@ fi
export SKIP_CHECK_UPDATES="1"
[[ "$MISSING_DESKTOP_FILE" == 1 ]] && portwine_missing_shortcut
[[ "$MISSING_DESKTOP_FILE" == "1" ]] && portwine_missing_shortcut
if [[ -n $(basename "${portwine_exe}" | grep .ppack) ]] ; then
unset PW_SANDBOX_HOME_PATH
......@@ -548,9 +548,9 @@ esac
if [[ -z "${PW_COMMENT_DB}" ]] ; then
if [[ -n "${PORTPROTON_NAME}" ]] ; then
PW_COMMENT_DB="$(gettext "Launching") <b>${PORTPROTON_NAME}</b>"
PW_COMMENT_DB="$(gettext "Launching") <b>$(print_wrapped "${PORTPROTON_NAME}" "50")</b>"
else
PW_COMMENT_DB="$(gettext "Launching") <b>${PORTWINE_DB}</b>"
PW_COMMENT_DB="$(gettext "Launching") <b>$(print_wrapped "${PORTWINE_DB}" "50")</b>"
fi
fi
......@@ -713,7 +713,7 @@ else
resize_png "${PW_NAME_D_ICON}" "${PW_NAME_D_ICON_48//"${PORT_WINE_PATH}/data/img/"/}" "48"
resize_png "${PW_NAME_D_ICON}" "${PW_NAME_D_ICON_128//"${PORT_WINE_PATH}/data/img/"/}" "128"
fi
PW_GENERATE_BUTTONS+="--field= ${PW_DESKTOP_FILES//".desktop"/""}!${PW_NAME_D_ICON_48}.png!:FBTN%@bash -c \"run_desktop_b_click "${PW_DESKTOP_FILES// /@_@}"\"%"
PW_GENERATE_BUTTONS+="--field= $(print_wrapped "${PW_DESKTOP_FILES//".desktop"/""}" "20" "...")!${PW_NAME_D_ICON_48}.png!:FBTN%@bash -c \"run_desktop_b_click "${PW_DESKTOP_FILES// /@_@}"\"%"
done
IFS="$orig_IFS"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment