Add an f_show_err() function -- acts pretty much the same as f_show_msg()
except it stylizes the msgbox widget to indicate an Error has occurred by setting an appropriate title and default message.
This commit is contained in:
parent
57f3f6ee5d
commit
8a316c0005
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=257783
@ -40,6 +40,7 @@ msg_afterstep_desc="Ports to support the AfterStep window manager."
|
||||
msg_all="All"
|
||||
msg_all_desc="All available packages in all categories."
|
||||
msg_always_try_sudo_when_run_as="Always try sudo(8) when run as %s"
|
||||
msg_an_unknown_error_occurred="An unknown error occurred"
|
||||
msg_arabic_desc="Ported software for Arab countries."
|
||||
msg_archivers_desc="Utilities for archiving and unarchiving data."
|
||||
msg_armenia="Armenia"
|
||||
|
@ -358,6 +358,30 @@ f_show_msg()
|
||||
fi
|
||||
}
|
||||
|
||||
# f_show_err $format [$arguments ...]
|
||||
#
|
||||
# Display a message in a dialog box with ``Error'' i18n title (overridden by
|
||||
# setting msg_error) using printf(1) syntax. If running non-interactively,
|
||||
# the process will terminate (using [above] f_die()).
|
||||
#
|
||||
f_show_err()
|
||||
{
|
||||
[ "$nonInteractive" ] && f_die
|
||||
|
||||
local msg
|
||||
msg=$( printf "$@" )
|
||||
|
||||
: ${msg:=${msg_an_unknown_error_occurred:-An unknown error occurred}}
|
||||
|
||||
if [ "$_DIALOG_SUBR" ]; then
|
||||
f_dialog_title "${msg_error:-Error}"
|
||||
f_dialog_msgbox "$msg"
|
||||
f_dialog_title_restore
|
||||
else
|
||||
dialog --title "${msg_error:-Error}" --msgbox "$msg" 0 0
|
||||
fi
|
||||
return $SUCCESS
|
||||
}
|
||||
|
||||
# f_yesno $format [$arguments ...]
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user