stop monkey frontend using depricated warn_user API

This commit is contained in:
Vincent Sanders 2016-04-29 10:53:31 +01:00
parent b2e8c0d54f
commit 746177ee39
3 changed files with 32 additions and 25 deletions

View File

@ -37,6 +37,13 @@ static uint32_t win_ctr = 0;
static struct gui_window *gw_ring = NULL; static struct gui_window *gw_ring = NULL;
/* exported function documented in monkey/browser.h */
nserror monkey_warn_user(const char *warning, const char *detail)
{
fprintf(stderr, "WARN %s %s\n", warning, detail);
return NSERROR_OK;
}
struct gui_window * struct gui_window *
monkey_find_window_by_num(uint32_t win_num) monkey_find_window_by_num(uint32_t win_num)
{ {
@ -366,6 +373,9 @@ static void
monkey_window_handle_go(int argc, char **argv) monkey_window_handle_go(int argc, char **argv)
{ {
struct gui_window *gw; struct gui_window *gw;
nsurl *url;
nsurl *ref_url = NULL;
nserror error;
if (argc < 4 || argc > 5) { if (argc < 4 || argc > 5) {
fprintf(stdout, "ERROR WINDOW GO ARGS BAD\n"); fprintf(stdout, "ERROR WINDOW GO ARGS BAD\n");
@ -376,31 +386,32 @@ monkey_window_handle_go(int argc, char **argv)
if (gw == NULL) { if (gw == NULL) {
fprintf(stdout, "ERROR WINDOW NUM BAD\n"); fprintf(stdout, "ERROR WINDOW NUM BAD\n");
} else { return;
nsurl *url; }
nsurl *ref_url = NULL;
nserror error;
error = nsurl_create(argv[3], &url); error = nsurl_create(argv[3], &url);
if (error != NSERROR_OK) { if (error == NSERROR_OK) {
warn_user(messages_get_errorcode(error), 0); if (argc == 5) {
} else { error = nsurl_create(argv[4], &ref_url);
if (argc == 5) { }
error = nsurl_create(argv[4], &ref_url);
}
browser_window_navigate(gw->bw, if (error == NSERROR_OK) {
url, error = browser_window_navigate(gw->bw,
ref_url, url,
BW_NAVIGATE_HISTORY, ref_url,
NULL, BW_NAVIGATE_HISTORY,
NULL, NULL,
NULL); NULL,
nsurl_unref(url); NULL);
if (ref_url != NULL) { if (ref_url != NULL) {
nsurl_unref(ref_url); nsurl_unref(ref_url);
} }
} }
nsurl_unref(url);
}
if (error != NSERROR_OK) {
monkey_warn_user(messages_get_errorcode(error), 0);
} }
} }

View File

@ -43,4 +43,6 @@ void monkey_window_process_reformats(void);
void monkey_window_handle_command(int argc, char **argv); void monkey_window_handle_command(int argc, char **argv);
void monkey_kill_browser_windows(void); void monkey_kill_browser_windows(void);
nserror monkey_warn_user(const char *warning, const char *detail);
#endif /* NETSURF_MONKEY_BROWSER_H */ #endif /* NETSURF_MONKEY_BROWSER_H */

View File

@ -223,12 +223,6 @@ static nserror set_defaults(struct nsoption_s *defaults)
return NSERROR_OK; return NSERROR_OK;
} }
static nserror monkey_warn_user(const char *warning, const char *detail)
{
fprintf(stderr, "WARN %s %s\n", warning, detail);
return NSERROR_OK;
}
/** /**
* Ensures output logging stream is correctly configured * Ensures output logging stream is correctly configured