DialogAlert... -> Alert...

SVN revision: 36793
This commit is contained in:
Kim Woelders 2008-10-18 19:05:18 +00:00
parent 0563113280
commit c8f3f10a81
7 changed files with 73 additions and 95 deletions

View File

@ -453,8 +453,6 @@ int ThemeConfigLoad(void);
/* dialog.c */ /* dialog.c */
void __PRINTF_2__ DialogOK(const char *title, const char *fmt, ...); void __PRINTF_2__ DialogOK(const char *title, const char *fmt, ...);
void DialogOKstr(const char *title, const char *txt); void DialogOKstr(const char *title, const char *txt);
void __PRINTF__ DialogAlert(const char *fmt, ...);
void __PRINTF__ DialogAlertOK(const char *fmt, ...);
/* econfig.c */ /* econfig.c */
void ConfigurationLoad(void); void ConfigurationLoad(void);

View File

@ -106,25 +106,22 @@ execApplication(const char *params, int flags)
{ {
/* absolute path */ /* absolute path */
if (isabspath(exe)) if (isabspath(exe))
DialogAlertOK(_ AlertOK(_("There was an error running the program:\n"
("There was an error running the program:\n" "%s\n"
"%s\n" "This program could not be executed.\n"
"This program could not be executed.\n" "This is because the file does not exist.\n"), exe);
"This is because the file does not exist.\n"),
exe);
/* relative path */ /* relative path */
else else
DialogAlertOK(_ AlertOK(_("There was an error running the program:\n"
("There was an error running the program:\n" "%s\n"
"%s\n" "This program could not be executed.\n"
"This program could not be executed.\n" "This is most probably because this "
"This is most probably because this " "program is not in the\n"
"program is not in the\n" "path for your shell which is %s. "
"path for your shell which is %s. " "I suggest you read the manual\n"
"I suggest you read the manual\n" "page for that shell and read up how to "
"page for that shell and read up how to " "change or add to your\n"
"change or add to your\n" "execution path.\n"), exe, sh);
"execution path.\n"), exe, sh);
} }
else else
/* it is a node on the filing sys */ /* it is a node on the filing sys */
@ -134,46 +131,41 @@ execApplication(const char *params, int flags)
{ {
/* can execute it */ /* can execute it */
if (canexec(path)) if (canexec(path))
DialogAlertOK(_ AlertOK(_("There was an error running the program:\n"
("There was an error running the program:\n" "%s\n"
"%s\n" "This program could not be executed.\n"
"This program could not be executed.\n" "I am unsure as to why you could not "
"I am unsure as to why you could not " "do this. The file exists,\n"
"do this. The file exists,\n" "is a file, and you are allowed to "
"is a file, and you are allowed to " "execute it. I suggest you look\n"
"execute it. I suggest you look\n" "into this.\n"), path);
"into this.\n"), path);
/* not executable file */ /* not executable file */
else else
DialogAlertOK(_ AlertOK(_("There was an error running the program:\n"
("There was an error running the program:\n" "%s\n"
"%s\n" "This program could not be executed.\n"
"This program could not be executed.\n" "This is because the file exists, is a "
"This is because the file exists, is a " "file, but you are unable\n"
"file, but you are unable\n" "to execute it because you do not "
"to execute it because you do not " "have execute " "access to this file.\n"), path);
"have execute "
"access to this file.\n"), path);
} }
/* it's not a file */ /* it's not a file */
else else
{ {
/* its a dir */ /* its a dir */
if (isdir(path)) if (isdir(path))
DialogAlertOK(_ AlertOK(_("There was an error running the program:\n"
("There was an error running the program:\n" "%s\n"
"%s\n" "This program could not be executed.\n"
"This program could not be executed.\n" "This is because the file is in fact "
"This is because the file is in fact " "a directory.\n"), path);
"a directory.\n"), path);
/* its not a file or a dir */ /* its not a file or a dir */
else else
DialogAlertOK(_ AlertOK(_("There was an error running the program:\n"
("There was an error running the program:\n" "%s\n"
"%s\n" "This program could not be executed.\n"
"This program could not be executed.\n" "This is because the file is not a "
"This is because the file is not a " "regular file.\n"), path);
"regular file.\n"), path);
} }
Efree(path); Efree(path);
} }
@ -194,7 +186,7 @@ Espawn(int argc __UNUSED__, char **argv)
execvp(argv[0], argv); execvp(argv[0], argv);
DialogAlertOK(_("There was an error running the program:\n%s\n"), argv[0]); AlertOK(_("There was an error running the program:\n%s\n"), argv[0]);
exit(100); exit(100);
} }

View File

@ -569,3 +569,16 @@ Alert(const char *fmt, ...)
ShowAlert(_("Enlightenment Message Dialog"), _("Ignore this"), ShowAlert(_("Enlightenment Message Dialog"), _("Ignore this"),
_("Restart Enlightenment"), _("Quit Enlightenment"), text); _("Restart Enlightenment"), _("Quit Enlightenment"), text);
} }
void
AlertOK(const char *fmt, ...)
{
char text[10240];
va_list args;
va_start(args, fmt);
Evsnprintf(text, 10240, fmt, args);
va_end(args);
ShowAlert(_("Attention !!!"), _("OK"), NULL, NULL, text);
}

View File

@ -28,6 +28,7 @@
/* alert.c */ /* alert.c */
void __PRINTF__ Alert(const char *fmt, ...); void __PRINTF__ Alert(const char *fmt, ...);
void __PRINTF__ AlertOK(const char *fmt, ...);
void __PRINTF_5__ AlertX(const char *title, const char *ignore, void __PRINTF_5__ AlertX(const char *title, const char *ignore,
const char *restart, const char *quit, const char *restart, const char *quit,
const char *fmt, ...); const char *fmt, ...);

View File

@ -2042,30 +2042,6 @@ DialogOKstr(const char *title, const char *txt)
DialogShow(d); DialogShow(d);
} }
void
DialogAlert(const char *fmt, ...)
{
char text[10240];
va_list args;
va_start(args, fmt);
Evsnprintf(text, 10240, fmt, args);
va_end(args);
Alert(text);
}
void
DialogAlertOK(const char *fmt, ...)
{
char text[10240];
va_list args;
va_start(args, fmt);
Evsnprintf(text, 10240, fmt, args);
va_end(args);
AlertX(_("Attention !!!"), _("OK"), NULL, NULL, text);
}
/* /*
* Dialog event handlers * Dialog event handlers
*/ */

View File

@ -31,7 +31,6 @@ SignalHandler(int sig)
{ {
static int loop_count = 0; static int loop_count = 0;
int status; int status;
const char *txt;
Mode.wm.in_signal_handler = 1; Mode.wm.in_signal_handler = 1;
@ -59,17 +58,17 @@ SignalHandler(int sig)
break; break;
case SIGILL: case SIGILL:
txt = _("Enlightenment performed an Illegal Instruction.\n" "\n" Alert(_("Enlightenment performed an Illegal Instruction.\n" "\n"
"This most likely is due to you having installed an run a\n" "This most likely is due to you having installed an run a\n"
"binary of Enlightenment that was compiled for a make or model\n" "binary of Enlightenment that was compiled for a make or model\n"
"of CPU not 100%% identical or compatible with yours. Please\n" "of CPU not 100%% identical or compatible with yours. Please\n"
"either obtain the correct package for your system, or\n" "either obtain the correct package for your system, or\n"
"re-compile Enlightenment and possibly any support libraries\n" "re-compile Enlightenment and possibly any support libraries\n"
"that you got in binary format to run Enlightenment.\n"); "that you got in binary format to run Enlightenment.\n"));
goto do_alert; goto do_abort;
case SIGFPE: case SIGFPE:
txt = _("Enlightenment caused a Floating Point Exception.\n" "\n" Alert(_("Enlightenment caused a Floating Point Exception.\n" "\n"
"This means that Enlightenment or support library routines it calls\n" "This means that Enlightenment or support library routines it calls\n"
"have performed an illegal mathematical operation (most likely\n" "have performed an illegal mathematical operation (most likely\n"
"dividing a number by zero). This is most likely a bug. It is\n" "dividing a number by zero). This is most likely a bug. It is\n"
@ -77,11 +76,11 @@ SignalHandler(int sig)
"compile Enlightenment with debugging symbols in and run\n" "compile Enlightenment with debugging symbols in and run\n"
"Enlightenment under gdb so you can backtrace for where it died and\n" "Enlightenment under gdb so you can backtrace for where it died and\n"
"send in a useful bug report with backtrace information and variable\n" "send in a useful bug report with backtrace information and variable\n"
"dumps etc.\n"); "dumps etc.\n"));
goto do_alert; goto do_abort;
case SIGSEGV: case SIGSEGV:
txt = _("Enlightenment caused Segment Violation (Segfault)\n" "\n" Alert(_("Enlightenment caused Segment Violation (Segfault)\n" "\n"
"This means that Enlightenment or support library routines it calls\n" "This means that Enlightenment or support library routines it calls\n"
"have accessed areas of your system's memory that they are not\n" "have accessed areas of your system's memory that they are not\n"
"allowed access to. This is most likely a bug. It is recommended to\n" "allowed access to. This is most likely a bug. It is recommended to\n"
@ -89,17 +88,17 @@ SignalHandler(int sig)
"Enlightenment with debugging symbols in and run Enlightenment\n" "Enlightenment with debugging symbols in and run Enlightenment\n"
"under gdb so you can backtrace for where it died and send in a\n" "under gdb so you can backtrace for where it died and send in a\n"
"useful bug report with backtrace information and variable\n" "useful bug report with backtrace information and variable\n"
"dumps etc.\n"); "dumps etc.\n"));
goto do_alert; goto do_abort;
case SIGBUS: case SIGBUS:
txt = _("Enlightenment caused Bus Error.\n" "\n" Alert(_("Enlightenment caused Bus Error.\n" "\n"
"It is suggested you check your hardware and OS installation.\n" "It is suggested you check your hardware and OS installation.\n"
"It is highly unusual to cause Bus Errors on operational\n" "It is highly unusual to cause Bus Errors on operational\n"
"hardware.\n"); "hardware.\n"));
goto do_alert; goto do_abort;
do_alert: do_abort:
if (loop_count > 0) if (loop_count > 0)
abort(); abort();
loop_count++; loop_count++;
@ -107,7 +106,6 @@ SignalHandler(int sig)
disp = NULL; disp = NULL;
#endif #endif
Mode.wm.exit_now = 1; Mode.wm.exit_now = 1;
DialogAlert(txt);
SessionExit(EEXIT_ERROR, NULL); SessionExit(EEXIT_ERROR, NULL);
abort(); abort();
break; break;

View File

@ -340,12 +340,12 @@ ice_msgs_process(void)
if (status == IceProcessMessagesIOError) if (status == IceProcessMessagesIOError)
{ {
/* Less of the hope.... E survives */ /* Less of the hope.... E survives */
DialogAlert(_("ERROR!\n" "\n" Alert(_("ERROR!\n" "\n"
"Lost the Session Manager that was there?\n" "Lost the Session Manager that was there?\n"
"Here here session manager... come here... want a bone?\n" "Here here session manager... come here... want a bone?\n"
"Oh come now! Stop sulking! Bugger. Oh well. " "Oh come now! Stop sulking! Bugger. Oh well. "
"Will continue without\n" "a session manager.\n" "\n" "Will continue without\n" "a session manager.\n" "\n"
"I'll survive somehow.\n" "\n" "\n" "... I hope.\n")); "I'll survive somehow.\n" "\n" "\n" "... I hope.\n"));
ice_exit(); ice_exit();
} }
} }