summaryrefslogtreecommitdiff
path: root/beos/gui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'beos/gui.cpp')
-rw-r--r--beos/gui.cpp57
1 files changed, 30 insertions, 27 deletions
diff --git a/beos/gui.cpp b/beos/gui.cpp
index 5171b211a..fde049525 100644
--- a/beos/gui.cpp
+++ b/beos/gui.cpp
@@ -113,6 +113,29 @@ static int sEventPipe[2];
// #pragma mark - class NSBrowserFrameView
+/**
+ * Display a warning for a serious problem (eg memory exhaustion).
+ *
+ * \param warning message key for warning message
+ * \param detail additional message, or 0
+ */
+static nserror beos_warn_user(const char *warning, const char *detail)
+{
+ LOG("warn_user: %s (%s)", warning, detail);
+ BAlert *alert;
+ BString text(warning);
+ if (detail)
+ text << ":\n" << detail;
+
+ alert = new BAlert("NetSurf Warning", text.String(), "Debug", "Ok",
+ NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
+ if (alert->Go() < 1) {
+ debugger("warn_user");
+ }
+
+ return NSERROR_OK;
+}
+
NSBrowserApplication::NSBrowserApplication()
: BApplication("application/x-vnd.NetSurf")
{
@@ -672,7 +695,7 @@ static void gui_init(int argc, char** argv)
nsurl_unref(url);
}
if (error != NSERROR_OK) {
- warn_user(messages_get_errorcode(error), 0);
+ beos_warn_user(messages_get_errorcode(error), 0);
}
if (gFirstRefsReceived) {
@@ -804,7 +827,7 @@ void nsbeos_gui_view_source(struct hlcache_handle *content)
const char *source = content_get_source_data(content, &size);
if (!content || !source) {
- warn_user("MiscError", "No document source");
+ beos_warn_user("MiscError", "No document source");
return;
}
@@ -826,7 +849,7 @@ void nsbeos_gui_view_source(struct hlcache_handle *content)
* filename. */
const char *filename = filename_request();
if (!filename) {
- warn_user("NoMemory", 0);
+ beos_warn_user("NoMemory", 0);
return;
}
path.SetTo(TEMP_FILENAME_PREFIX);
@@ -834,12 +857,12 @@ void nsbeos_gui_view_source(struct hlcache_handle *content)
BFile file(path.Path(), B_WRITE_ONLY | B_CREATE_FILE);
err = file.InitCheck();
if (err < B_OK) {
- warn_user("IOError", strerror(err));
+ beos_warn_user("IOError", strerror(err));
return;
}
err = file.Write(source, size);
if (err < B_OK) {
- warn_user("IOError", strerror(err));
+ beos_warn_user("IOError", strerror(err));
return;
}
lwc_string *mime = content_get_mime_type(content);
@@ -909,31 +932,11 @@ static nserror gui_launch_url(struct nsurl *url)
char *args[2] = { (char *)nsurl_access(url), NULL };
status = be_roster->Launch(mimeType.String(), 1, args);
if (status < B_OK)
- warn_user("Cannot launch url", strerror(status));
+ beos_warn_user("Cannot launch url", strerror(status));
return NSERROR_OK;
}
-/**
- * Display a warning for a serious problem (eg memory exhaustion).
- *
- * \param warning message key for warning message
- * \param detail additional message, or 0
- */
-
-void warn_user(const char *warning, const char *detail)
-{
- LOG("warn_user: %s (%s)", warning, detail);
- BAlert *alert;
- BString text(warning);
- if (detail)
- text << ":\n" << detail;
-
- alert = new BAlert("NetSurf Warning", text.String(), "Debug", "Ok", NULL,
- B_WIDTH_AS_USUAL, B_WARNING_ALERT);
- if (alert->Go() < 1)
- debugger("warn_user");
-}
void die(const char * const error)
{
@@ -965,11 +968,11 @@ static struct gui_fetch_table beos_fetch_table = {
static struct gui_misc_table beos_misc_table = {
beos_schedule,
+ beos_warn_user,
gui_quit,
gui_launch_url,
NULL, //cert_verify
gui_401login_open,
- NULL, // warning
NULL, // pdf_password (if we have Haru support)
};