mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-22 22:41:30 +03:00
change url setting api to take an nsurl instead of a text string
This commit is contained in:
parent
03abea12a7
commit
c14ddad660
15
amiga/gui.c
15
amiga/gui.c
@ -4774,19 +4774,22 @@ static void gui_window_set_status(struct gui_window *g, const char *text)
|
||||
}
|
||||
}
|
||||
|
||||
static nserror gui_window_set_url(struct gui_window *g, const char *url)
|
||||
static nserror gui_window_set_url(struct gui_window *g, nsurl *url)
|
||||
{
|
||||
int cur_tab = 0;
|
||||
|
||||
if(!g) return;
|
||||
|
||||
if(g->tab_node && (g->shared->tabs > 1)) GetAttr(CLICKTAB_Current,
|
||||
g->shared->objects[GID_TABS], (ULONG *)&cur_tab);
|
||||
if ((g->tab_node) && (g->shared->tabs > 1)) {
|
||||
GetAttr(CLICKTAB_Current,
|
||||
g->shared->objects[GID_TABS],
|
||||
(ULONG *)&cur_tab);
|
||||
}
|
||||
|
||||
if((cur_tab == g->tab) || (g->shared->tabs <= 1))
|
||||
{
|
||||
if ((cur_tab == g->tab) || (g->shared->tabs <= 1)) {
|
||||
RefreshSetGadgetAttrs((struct Gadget *)g->shared->objects[GID_URL],
|
||||
g->shared->win, NULL, STRINGA_TextVal, url, TAG_DONE);
|
||||
g->shared->win, NULL, STRINGA_TextVal,
|
||||
nsurl_access(url), TAG_DONE);
|
||||
}
|
||||
|
||||
ami_update_buttons(g->shared);
|
||||
|
12
atari/gui.c
12
atari/gui.c
@ -115,7 +115,7 @@ EVMULT_OUT aes_event_out;
|
||||
short aes_msg_out[8];
|
||||
|
||||
bool gui_window_get_scroll(struct gui_window *w, int *sx, int *sy);
|
||||
static nserror gui_window_set_url(struct gui_window *w, const char *url);
|
||||
static nserror gui_window_set_url(struct gui_window *w, nsurl *url);
|
||||
|
||||
/**
|
||||
* Core atari event processing.
|
||||
@ -220,7 +220,7 @@ gui_window_create(struct browser_window *bw,
|
||||
option_window_x, option_window_y,
|
||||
option_window_width, option_window_height
|
||||
};
|
||||
gui_window_set_url(gw, "");
|
||||
gui_window_set_url(gw, corestring_nsurl_about_blank);
|
||||
gui_window_set_pointer(gw, BROWSER_POINTER_DEFAULT);
|
||||
gui_set_input_gui_window(gw);
|
||||
window_open(gw->root, gw, pos);
|
||||
@ -553,24 +553,24 @@ void gui_window_set_pointer(struct gui_window *gw, gui_pointer_shape shape)
|
||||
}
|
||||
|
||||
|
||||
static nserror gui_window_set_url(struct gui_window *w, const char *url)
|
||||
static nserror gui_window_set_url(struct gui_window *w, nsurl *url)
|
||||
{
|
||||
int l;
|
||||
|
||||
if (w == NULL)
|
||||
return;
|
||||
|
||||
l = strlen(url)+1;
|
||||
l = strlen(nsurl_access(url))+1;
|
||||
|
||||
if (w->url == NULL) {
|
||||
w->url = malloc(l);
|
||||
} else {
|
||||
w->url = realloc(w->url, l);
|
||||
}
|
||||
strncpy(w->url, url, l);
|
||||
strncpy(w->url, nsurl_access(url), l);
|
||||
w->url[l] = 0;
|
||||
if(input_window == w->root->active_gui_window) {
|
||||
toolbar_set_url(w->root->toolbar, url);
|
||||
toolbar_set_url(w->root->toolbar, nsurl_access(url));
|
||||
}
|
||||
|
||||
return NSERROR_OK;
|
||||
|
@ -194,9 +194,9 @@ static void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape
|
||||
}
|
||||
}
|
||||
|
||||
static nserror gui_window_set_url(struct gui_window *g, const char *url)
|
||||
static nserror gui_window_set_url(struct gui_window *g, struct nsurl *url)
|
||||
{
|
||||
[(BrowserViewController *)g setUrl: [NSString stringWithUTF8String: url]];
|
||||
[(BrowserViewController *)g setUrl: [NSString stringWithUTF8String: nsurl_access(url)]];
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
|
@ -1811,7 +1811,7 @@ browser_window_refresh_url_bar_internal(struct browser_window *bw, nsurl *url)
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
return guit->window->set_url(bw->window, nsurl_access(url));
|
||||
return guit->window->set_url(bw->window, url);
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,7 +42,7 @@ static void gui_default_window_set_title(struct gui_window *g, const char *title
|
||||
{
|
||||
}
|
||||
|
||||
static nserror gui_default_window_set_url(struct gui_window *g, const char *url)
|
||||
static nserror gui_default_window_set_url(struct gui_window *g, struct nsurl *url)
|
||||
{
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ struct gui_window_table {
|
||||
* \param gw window to update.
|
||||
* \param url The url to use as icon.
|
||||
*/
|
||||
nserror (*set_url)(struct gui_window *gw, const char *url);
|
||||
nserror (*set_url)(struct gui_window *gw, struct nsurl *url);
|
||||
|
||||
/**
|
||||
* Set a favicon for a gui window.
|
||||
|
@ -1896,9 +1896,9 @@ gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape)
|
||||
}
|
||||
|
||||
static nserror
|
||||
gui_window_set_url(struct gui_window *g, const char *url)
|
||||
gui_window_set_url(struct gui_window *g, nsurl *url)
|
||||
{
|
||||
fbtk_set_text(g->url, url);
|
||||
fbtk_set_text(g->url, nsurl_access(url));
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
|
@ -2291,13 +2291,13 @@ void gui_window_set_title(struct gui_window *gw, const char *title)
|
||||
}
|
||||
|
||||
|
||||
nserror gui_window_set_url(struct gui_window *gw, const char *url)
|
||||
nserror gui_window_set_url(struct gui_window *gw, nsurl *url)
|
||||
{
|
||||
struct nsgtk_scaffolding *g;
|
||||
|
||||
g = nsgtk_get_scaffold(gw);
|
||||
if (g->top_level == gw) {
|
||||
gtk_entry_set_text(GTK_ENTRY(g->url_bar), url);
|
||||
gtk_entry_set_text(GTK_ENTRY(g->url_bar), nsurl_access(url));
|
||||
gtk_editable_set_position(GTK_EDITABLE(g->url_bar), -1);
|
||||
}
|
||||
return NSERROR_OK;
|
||||
|
@ -26,6 +26,7 @@ struct bitmap;
|
||||
struct hlcache_handle;
|
||||
struct gui_window;
|
||||
struct gui_search_web_table;
|
||||
struct nsurl;
|
||||
|
||||
extern struct gui_search_web_table *nsgtk_search_web_table;
|
||||
|
||||
@ -235,7 +236,7 @@ nserror nsgtk_scaffolding_new_tab(struct gui_window *gw);
|
||||
|
||||
/* core acessors */
|
||||
void gui_window_set_title(struct gui_window *g, const char *title);
|
||||
nserror gui_window_set_url(struct gui_window *g, const char *url);
|
||||
nserror gui_window_set_url(struct gui_window *g, struct nsurl *url);
|
||||
void gui_window_start_throbber(struct gui_window *g);
|
||||
void gui_window_stop_throbber(struct gui_window *g);
|
||||
|
||||
|
@ -252,9 +252,9 @@ gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape)
|
||||
}
|
||||
|
||||
static nserror
|
||||
gui_window_set_url(struct gui_window *g, const char *url)
|
||||
gui_window_set_url(struct gui_window *g, nsurl *url)
|
||||
{
|
||||
fprintf(stdout, "WINDOW SET_URL WIN %u URL %s\n", g->win_num, url);
|
||||
fprintf(stdout, "WINDOW SET_URL WIN %u URL %s\n", g->win_num, nsurl_access(url));
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
|
@ -851,12 +851,12 @@ bool ro_gui_url_bar_menu_select(struct url_bar *url_bar, wimp_i i,
|
||||
nsurl *url;
|
||||
nserror error;
|
||||
|
||||
gui_window_set_url(g, urltxt);
|
||||
|
||||
error = nsurl_create(urltxt, &url);
|
||||
if (error != NSERROR_OK) {
|
||||
warn_user(messages_get_errorcode(error), 0);
|
||||
} else {
|
||||
gui_window_set_url(g, url);
|
||||
|
||||
browser_window_navigate(g->bw,
|
||||
url,
|
||||
NULL,
|
||||
|
@ -1051,10 +1051,10 @@ void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape)
|
||||
|
||||
|
||||
/* exported function documented in riscos/window.h */
|
||||
nserror gui_window_set_url(struct gui_window *g, const char *url)
|
||||
nserror gui_window_set_url(struct gui_window *g, nsurl *url)
|
||||
{
|
||||
if (g->toolbar) {
|
||||
ro_toolbar_set_url(g->toolbar, url, true, false);
|
||||
ro_toolbar_set_url(g->toolbar, nsurl_access(url), true, false);
|
||||
ro_gui_url_complete_start(g->toolbar);
|
||||
}
|
||||
|
||||
@ -3913,12 +3913,13 @@ void ro_gui_window_launch_url(struct gui_window *g, const char *url1)
|
||||
return;
|
||||
|
||||
ro_gui_url_complete_close();
|
||||
gui_window_set_url(g, url1);
|
||||
|
||||
error = nsurl_create(url1, &url);
|
||||
if (error != NSERROR_OK) {
|
||||
warn_user(messages_get_errorcode(error), 0);
|
||||
} else {
|
||||
gui_window_set_url(g, url);
|
||||
|
||||
browser_window_navigate(g->bw, url,
|
||||
NULL, BW_NAVIGATE_HISTORY,
|
||||
NULL, NULL, NULL);
|
||||
|
@ -39,7 +39,7 @@ bool ro_gui_window_check_menu(wimp_menu *menu);
|
||||
* \param g gui_window to update
|
||||
* \param url new url for address bar
|
||||
*/
|
||||
nserror gui_window_set_url(struct gui_window *g, const char *url);
|
||||
nserror gui_window_set_url(struct gui_window *g, nsurl *url);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1662,9 +1662,9 @@ struct nsws_pointers *nsws_get_pointers(void)
|
||||
return &nsws_pointer;
|
||||
}
|
||||
|
||||
static nserror gui_window_set_url(struct gui_window *w, const char *url)
|
||||
static nserror gui_window_set_url(struct gui_window *w, nsurl *url)
|
||||
{
|
||||
SendMessage(w->urlbar, WM_SETTEXT, 0, (LPARAM) url);
|
||||
SendMessage(w->urlbar, WM_SETTEXT, 0, (LPARAM) nsurl_access(url));
|
||||
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user