diff --git a/amiga/launch.c b/amiga/launch.c index 84d362fa1..1405d6a71 100755 --- a/amiga/launch.c +++ b/amiga/launch.c @@ -122,25 +122,31 @@ void ami_openurl_close(const char *scheme) ami_openurl_free_list(&ami_unsupportedprotocols); } -void gui_launch_url(const char *url) +nserror gui_launch_url(struct nsurl *url) { APTR procwin = SetProcWindow((APTR)-1L); char *launchurl = NULL; - if(ami_openurl_check_list(&ami_unsupportedprotocols, url) == FALSE) + if(ami_openurl_check_list(&ami_unsupportedprotocols, nsurl_access(url)) == FALSE) { if(IOpenURL) { URL_OpenA((STRPTR)url,NULL); } else { - if(launchurl = ASPrintf("URL:%s",url)) { + if(launchurl = ASPrintf("URL:%s", nsurl_access(url))) { BPTR fptr = Open(launchurl,MODE_OLDFILE); - if(fptr) Close(fptr); - else ami_openurl_add_protocol(url); + if(fptr) + { + Close(fptr); + } else { + ami_openurl_add_protocol(nsurl_access(url)); + } FreeVec(launchurl); } } } - SetProcWindow(procwin); + SetProcWindow(procwin); + + return NSERROR_OK; } diff --git a/amiga/launch.h b/amiga/launch.h index 7baa6ca27..cab638b1d 100755 --- a/amiga/launch.h +++ b/amiga/launch.h @@ -26,6 +26,6 @@ void ami_openurl_open(void); void ami_openurl_close(void); -void gui_launch_url(const char *url); +nserror gui_launch_url(struct nsurl *url); #endif diff --git a/beos/gui.cpp b/beos/gui.cpp index d21dbe512..db4374512 100644 --- a/beos/gui.cpp +++ b/beos/gui.cpp @@ -896,12 +896,13 @@ void nsbeos_gui_view_source(struct hlcache_handle *content) * Broadcast an URL that we can't handle. */ -static void gui_launch_url(const char *url) +static nserror gui_launch_url(struct nsurl *url) { status_t status; // try to open it as an URI BString mimeType = "application/x-vnd.Be.URL."; - BString arg(url); + BString arg(nsurl_access(url)); + mimeType.Append(arg, arg.FindFirst(":")); // special case, text/x-email is used traditionally @@ -913,11 +914,12 @@ static void gui_launch_url(const char *url) // we just check if it's registered // if not there is likely no supporting app anyway if (!BMimeType::IsValid(mimeType.String())) - return; - char *args[2] = { (char *)url, NULL }; + return NSERROR_NO_FETCH_HANDLER; + 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)); + return NSERROR_OK; } diff --git a/cocoa/gui.m b/cocoa/gui.m index 9ba614475..1cb19a756 100644 --- a/cocoa/gui.m +++ b/cocoa/gui.m @@ -253,9 +253,10 @@ static void gui_create_form_select_menu(struct browser_window *bw, [menu release]; } -static void gui_launch_url(const char *url) +static nserror gui_launch_url(nsurl *url) { - [[NSWorkspace sharedWorkspace] openURL: [NSURL URLWithString: [NSString stringWithUTF8String: url]]]; + [[NSWorkspace sharedWorkspace] openURL: [NSURL URLWithString: [NSString stringWithUTF8String: nsurl_access(url)]]]; + return NSERROR_OK; } struct ssl_cert_info; diff --git a/desktop/browser.c b/desktop/browser.c index 01f57178d..6e3ed9718 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -839,7 +839,7 @@ browser_window_download(struct browser_window *bw, NULL, NULL, &l); if (error == NSERROR_NO_FETCH_HANDLER) { /* no internal handler for this type, call out to frontend */ - guit->browser->launch_url(nsurl_access(url)); + error = guit->browser->launch_url(url); } else if (error != NSERROR_OK) { LOG(("Failed to fetch download: %d", error)); } else { @@ -1932,7 +1932,7 @@ nserror browser_window_navigate(struct browser_window *bw, case NSERROR_NO_FETCH_HANDLER: /* no handler for this type */ /** @todo does this always try and download even unverifiable content? */ - guit->browser->launch_url(nsurl_access(url)); + error = guit->browser->launch_url(url); break; default: /* report error to user */ diff --git a/desktop/gui.h b/desktop/gui.h index bc7553c16..dc964db81 100644 --- a/desktop/gui.h +++ b/desktop/gui.h @@ -475,7 +475,7 @@ struct gui_browser_table { /** * core has no fetcher for url */ - void (*launch_url)(const char *url); + nserror (*launch_url)(struct nsurl *url); /** * create a form select menu diff --git a/desktop/gui_factory.c b/desktop/gui_factory.c index a60766647..b3a27fea2 100644 --- a/desktop/gui_factory.c +++ b/desktop/gui_factory.c @@ -515,8 +515,9 @@ static void gui_default_quit(void) } -static void gui_default_launch_url(const char *url) +static nserror gui_default_launch_url(struct nsurl *url) { + return NSERROR_NO_FETCH_HANDLER; } static void gui_default_create_form_select_menu(struct browser_window *bw, diff --git a/gtk/gui.c b/gtk/gui.c index 3f0d6119f..6933c2e1e 100644 --- a/gtk/gui.c +++ b/gtk/gui.c @@ -617,19 +617,21 @@ static void gui_create_form_select_menu(struct browser_window *bw, } -static void gui_launch_url(const char *url) +static nserror gui_launch_url(struct nsurl *url) { gboolean ok; GError *error = NULL; - ok = nsgtk_show_uri(NULL, url, GDK_CURRENT_TIME, &error); - if (ok == TRUE) - return; + ok = nsgtk_show_uri(NULL, nsurl_access(url), GDK_CURRENT_TIME, &error); + if (ok == TRUE) { + return NSERROR_OK; + } if (error) { warn_user(messages_get("URIOpenError"), error->message); g_error_free(error); } + return NSERROR_NO_FETCH_HANDLER; } void warn_user(const char *warning, const char *detail) diff --git a/monkey/main.c b/monkey/main.c index 10ec1baf8..08af69405 100644 --- a/monkey/main.c +++ b/monkey/main.c @@ -67,10 +67,10 @@ static void monkey_quit(void) monkey_fetch_filetype_fin(); } -static void -gui_launch_url(const char *url) +static nserror gui_launch_url(struct nsurl *url) { - fprintf(stdout, "GENERIC LAUNCH URL %s\n", url); + fprintf(stdout, "GENERIC LAUNCH URL %s\n", nsurl_access(url)); + return NSERROR_OK; } static void quit_handler(int argc, char **argv) diff --git a/riscos/gui.c b/riscos/gui.c index 82a1a74a1..f3d1f323a 100644 --- a/riscos/gui.c +++ b/riscos/gui.c @@ -2214,10 +2214,11 @@ void ro_gui_dump_browser_window(struct browser_window *bw) * Broadcast an URL that we can't handle. */ -static void gui_launch_url(const char *url) +static nserror gui_launch_url(struct nsurl *url) { - /* Try ant broadcast first */ - ro_url_broadcast(url); + /* Try ant broadcast */ + ro_url_broadcast(nsurl_access(url)); + return NSERROR_OK; }