X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=gui;h=23e9e903af340ccb74c936b4fd8704b32dfb8fee;hb=ab6d0fe33f57bb305b8d7e5f8bed0642d1b099d5;hp=6003a90ab18a11c51bf4ae4c0a98fa4e74c2bb38;hpb=021cb6acbe9be83506f27e9eff3cd434e6daf149;p=gsu.git diff --git a/gui b/gui index 6003a90..23e9e90 100644 --- a/gui +++ b/gui @@ -1,8 +1,10 @@ #!/bin/bash +# Copyright (C) 2006 Andre Noll +# Licensed under the LGPL, version 3. See COPYING and COPYING.LESSER. if [[ "$(type -t _gsu_setup)" != "function" ]]; then gsu_dir=${gsu_dir:-${BASH_SOURCE[0]%/*}} - . $gsu_dir/common || exit 1 + . "$gsu_dir/common" || exit 1 _gsu_setup fi @@ -78,15 +80,14 @@ gsu_textbox() # This is like gsu_textbox() but the text is passed as a string. gsu_msgbox() { + local tmp + # Some versions of dialog segfault if the text is too long. Hence we # always use a temporary file. - local tmp="$(mktemp gsu_msgbox.XXXXXXXXXX)" - - if (($? != 0)); then - ret=-$E_GSU_MKTEMP - result='temp file for textbox' - return - fi + gsu_make_tempfile 'gsu_msgbox.XXXXXXXXXX' + (($ret < 0)) && return + tmp="$result" + trap "rm -f $tmp" EXIT echo "$1" > "$tmp" gsu_textbox "$tmp" rm -f "$tmp" # ignore errors @@ -96,7 +97,7 @@ _gsu_menu() { local header="${1:-root}" local items="$2" - local i state opts num=0 + local i opts num=0 _get_geometry opts="$result 16"