summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--amiga/gui.c10
-rwxr-xr-xamiga/misc.c32
-rw-r--r--amiga/misc.h16
3 files changed, 31 insertions, 27 deletions
diff --git a/amiga/gui.c b/amiga/gui.c
index 8a05f4b9f..3c11d527d 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -5218,7 +5218,7 @@ int main(int argc, char** argv)
ret = netsurf_register(&amiga_table);
if (ret != NSERROR_OK) {
- warn_user("NetSurf operation table failed registration", "");
+ ami_misc_fatal_error("NetSurf operation table failed registration");
return RETURN_FAIL;
}
@@ -5274,20 +5274,20 @@ int main(int argc, char** argv)
/* user options setup */
ret = nsoption_init(ami_set_options, &nsoptions, &nsoptions_default);
if (ret != NSERROR_OK) {
- warn_user("Options failed to initialise", "");
+ ami_misc_fatal_error("Options failed to initialise");
return RETURN_FAIL;
}
nsoption_read(current_user_options, NULL);
ami_gui_commandline(&argc, argv); /* calls nsoption_commandline */
if (ami_locate_resource(messages, "Messages") == false) {
- warn_user("Cannot open Messages file", "");
+ ami_misc_fatal_error("Cannot open Messages file");
return RETURN_FAIL;
}
ret = netsurf_init(messages, current_user_cache);
if (ret != NSERROR_OK) {
- warn_user("NetSurf failed to initialise", "");
+ ami_misc_fatal_error("NetSurf failed to initialise");
return RETURN_FAIL;
}
@@ -5295,7 +5295,7 @@ int main(int argc, char** argv)
ret = amiga_icon_init();
if (ami_open_resources() == false) { /* alloc ports/asl reqs, open libraries/devices */
- warn_user("NoMemory", "");
+ ami_misc_fatal_error("Unable to allocate resources");
return RETURN_FAIL;
}
diff --git a/amiga/misc.c b/amiga/misc.c
index 2864a4525..530110f49 100755
--- a/amiga/misc.c
+++ b/amiga/misc.c
@@ -47,33 +47,45 @@
#include "amiga/misc.h"
#include "amiga/utf8.h"
-void warn_user(const char *warning, const char *detail)
+static LONG ami_misc_req(const char *message, int type)
{
Object *req = NULL;
- char *utf8warning = ami_utf8_easy(messages_get(warning));
- STRPTR bodytext = NULL;
+ LONG ret = 0;
- LOG(("%s %s", warning, detail));
-
- bodytext = ASPrintf("\33b%s\33n\n%s",
- utf8warning != NULL ? utf8warning : warning, detail);
+ LOG(("%s", message));
req = NewObject(REQUESTER_GetClass(), NULL,
REQ_Type, REQTYPE_INFO,
REQ_TitleText, messages_get("NetSurf"),
- REQ_BodyText, bodytext,
+ REQ_BodyText, message,
REQ_GadgetText, messages_get("OK"),
#ifdef __amigaos4__
- REQ_Image, (struct Image *)REQIMAGE_WARNING,
+ REQ_Image, (struct Image *)type,
/* REQ_CharSet, 106, */
#endif
TAG_DONE);
if (req) {
- IDoMethod(req, RM_OPENREQ, NULL, NULL, scrn);
+ ret = IDoMethod(req, RM_OPENREQ, NULL, NULL, scrn);
DisposeObject(req);
}
+ return ret;
+}
+
+void ami_misc_fatal_error(const char *message)
+{
+ ami_misc_req(message, REQIMAGE_ERROR);
+}
+
+void warn_user(const char *warning, const char *detail)
+{
+ char *utf8warning = ami_utf8_easy(messages_get(warning));
+ STRPTR bodytext = ASPrintf("\33b%s\33n\n%s",
+ utf8warning != NULL ? utf8warning : warning, detail);
+
+ ami_misc_req(bodytext, REQIMAGE_WARNING);
+
if(bodytext) FreeVec(bodytext);
if(utf8warning) free(utf8warning);
}
diff --git a/amiga/misc.h b/amiga/misc.h
index 9adbb7352..836372f18 100644
--- a/amiga/misc.h
+++ b/amiga/misc.h
@@ -23,16 +23,8 @@
extern struct gui_file_table *amiga_file_table;
char *translate_escape_chars(const char *s);
-int32 ami_warn_user_multi(const char *body, const char *opt1, const char *opt2, struct Window *win);
-
-/**
- * Cause an abnormal program termination.
- *
- * \note This never returns and is intended to terminate without any cleanup.
- *
- * \param error The message to display to the user.
- */
-void die(const char * const error) __attribute__ ((noreturn));
-
-
+void ami_misc_fatal_error(const char *message);
+int32 ami_warn_user_multi(const char *body,
+ const char *opt1, const char *opt2, struct Window *win);
#endif
+