[project @ 2006-02-10 18:10:09 by adrianl]

Improved reporting of startup errors

svn path=/import/netsurf/; revision=2068
This commit is contained in:
Adrian Lees 2006-02-10 18:10:09 +00:00
parent 7fe5a989e3
commit 9f0f47cff7

View File

@ -2176,19 +2176,40 @@ void gui_launch_url(const char *url)
void warn_user(const char *warning, const char *detail) void warn_user(const char *warning, const char *detail)
{ {
char warn_buffer[300]; union {
char warn_buffer[300];
os_error error;
} d;
LOG(("%s %s", warning, detail)); LOG(("%s %s", warning, detail));
snprintf(warn_buffer, sizeof warn_buffer, "%s %s",
messages_get(warning), if (dialog_warning) {
detail ? detail : ""); snprintf(d.warn_buffer, sizeof d.warn_buffer, "%s %s",
warn_buffer[sizeof warn_buffer - 1] = 0; messages_get(warning),
ro_gui_set_icon_string(dialog_warning, ICON_WARNING_MESSAGE, detail ? detail : "");
warn_buffer); d.warn_buffer[sizeof d.warn_buffer - 1] = 0;
xwimp_set_icon_state(dialog_warning, ICON_WARNING_HELP, ro_gui_set_icon_string(dialog_warning, ICON_WARNING_MESSAGE,
wimp_ICON_DELETED, wimp_ICON_DELETED); d.warn_buffer);
ro_gui_dialog_open(dialog_warning); xwimp_set_icon_state(dialog_warning, ICON_WARNING_HELP,
xos_bell(); wimp_ICON_DELETED, wimp_ICON_DELETED);
ro_gui_dialog_open(dialog_warning);
xos_bell();
}
else {
/* probably haven't initialised (properly), use a
non-multitasking error box */
snprintf(d.error.errmess, sizeof d.error.errmess, "%s %s",
messages_get(warning),
detail ? detail : "");
d.error.errmess[sizeof d.error.errmess - 1] = 0;
xwimp_report_error_by_category(&d.error,
wimp_ERROR_BOX_OK_ICON |
wimp_ERROR_BOX_GIVEN_CATEGORY |
wimp_ERROR_BOX_CATEGORY_ERROR <<
wimp_ERROR_BOX_CATEGORY_SHIFT,
"NetSurf", "!netsurf",
(osspriteop_area *) 1, 0, 0);
}
} }