mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-03-04 14:21:33 +03:00
replace save_link operation table entry usage of textural url with nsurl
This commit is contained in:
parent
49ac8c3a94
commit
bdfedb686b
@ -345,14 +345,14 @@ void ami_free_download_list(struct List *dllist)
|
||||
}while(node=nnode);
|
||||
}
|
||||
|
||||
void
|
||||
gui_window_save_link(struct gui_window *g, const char *url, const char *title)
|
||||
nserror
|
||||
gui_window_save_link(struct gui_window *g, nsurl *url, const char *title)
|
||||
{
|
||||
char fname[1024];
|
||||
STRPTR openurlstring,linkname;
|
||||
struct DiskObject *dobj = NULL;
|
||||
|
||||
linkname = ASPrintf("Link_to_%s",FilePart(url));
|
||||
linkname = ASPrintf("Link_to_%s",FilePart(nsurl_access(url)));
|
||||
|
||||
if(AslRequestTags(savereq,
|
||||
ASLFR_Window, g->shared->win,
|
||||
@ -374,11 +374,11 @@ gui_window_save_link(struct gui_window *g, const char *url, const char *title)
|
||||
if(fh = FOpen(fname,MODE_NEWFILE,0))
|
||||
{
|
||||
/* TODO: Should be URLOpen on OS4.1 */
|
||||
openurlstring = ASPrintf("openurl \"%s\"\n",url);
|
||||
openurlstring = ASPrintf("openurl \"%s\"\n",nsurl_access(url));
|
||||
FWrite(fh,openurlstring,1,strlen(openurlstring));
|
||||
FClose(fh);
|
||||
FreeVec(openurlstring);
|
||||
SetComment(fname,url);
|
||||
SetComment(fname, nsurl_access(url));
|
||||
|
||||
dobj = GetIconTags(NULL,ICONGETA_GetDefaultName,"url",
|
||||
ICONGETA_GetDefaultType,WBPROJECT,
|
||||
@ -396,6 +396,7 @@ gui_window_save_link(struct gui_window *g, const char *url, const char *title)
|
||||
}
|
||||
ami_reset_pointer(g->shared);
|
||||
}
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
BOOL ami_download_check_overwrite(const char *file, struct Window *win, ULONG size)
|
||||
|
@ -37,6 +37,6 @@ BOOL ami_download_window_event(struct gui_download_window *dw);
|
||||
void ami_free_download_list(struct List *dllist);
|
||||
BOOL ami_download_check_overwrite(const char *file, struct Window *win, ULONG size);
|
||||
|
||||
void gui_window_save_link(struct gui_window *g, const char *url, const char *title);
|
||||
nserror gui_window_save_link(struct gui_window *g, nsurl *url, const char *title);
|
||||
|
||||
#endif
|
||||
|
@ -164,7 +164,7 @@ union content_msg_data {
|
||||
} dragsave;
|
||||
/** CONTENT_MSG_SAVELINK - Save a URL */
|
||||
struct {
|
||||
const char *url;
|
||||
nsurl *url;
|
||||
const char *title;
|
||||
} savelink;
|
||||
/** CONTENT_MSG_POINTER - Mouse pointer to set */
|
||||
|
@ -62,10 +62,11 @@ static bool gui_default_window_drag_start(struct gui_window *g,
|
||||
return true;
|
||||
}
|
||||
|
||||
static void gui_default_window_save_link(struct gui_window *g,
|
||||
const char *url,
|
||||
static nserror gui_default_window_save_link(struct gui_window *g,
|
||||
nsurl *url,
|
||||
const char *title)
|
||||
{
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
static void gui_default_window_set_icon(struct gui_window *g,
|
||||
|
@ -237,7 +237,7 @@ struct gui_window_table {
|
||||
bool (*drag_start)(struct gui_window *g, gui_drag_type type, const struct rect *rect);
|
||||
|
||||
/** save link operation */
|
||||
void (*save_link)(struct gui_window *g, const char *url, const char *title);
|
||||
nserror (*save_link)(struct gui_window *g, nsurl *url, const char *title);
|
||||
|
||||
/**
|
||||
* Scrolls the specified area of a browser window into view.
|
||||
|
@ -306,12 +306,12 @@ gui_window_drag_start(struct gui_window *g, gui_drag_type type,
|
||||
return false;
|
||||
}
|
||||
|
||||
static void
|
||||
gui_window_save_link(struct gui_window *g, const char *url,
|
||||
const char *title)
|
||||
static nserror
|
||||
gui_window_save_link(struct gui_window *g, nsurl *url, const char *title)
|
||||
{
|
||||
fprintf(stdout, "WINDOW SAVE_LINK WIN %u URL %s TITLE %s\n",
|
||||
g->win_num, url, title);
|
||||
g->win_num, nsurl_access(url), title);
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
|
||||
|
@ -835,7 +835,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
|
||||
|
||||
} else if (mouse & BROWSER_MOUSE_CLICK_2 &&
|
||||
mouse & BROWSER_MOUSE_MOD_1) {
|
||||
msg_data.savelink.url = nsurl_access(url);
|
||||
msg_data.savelink.url = url;
|
||||
msg_data.savelink.title = title;
|
||||
content_broadcast(c, CONTENT_MSG_SAVELINK, msg_data);
|
||||
|
||||
|
@ -1280,14 +1280,12 @@ static bool gui_window_drag_start(struct gui_window *g, gui_drag_type type,
|
||||
* \param url The url of the link
|
||||
* \param title The title of the link
|
||||
*/
|
||||
static void gui_window_save_link(struct gui_window *g, const char *url,
|
||||
const char *title)
|
||||
static nserror
|
||||
gui_window_save_link(struct gui_window *g, nsurl *url, const char *title)
|
||||
{
|
||||
nsurl *nurl;
|
||||
nsurl_create(url, &nurl);
|
||||
ro_gui_save_prepare(GUI_SAVE_LINK_URL, NULL, NULL, nurl, title);
|
||||
nsurl_unref(nurl);
|
||||
ro_gui_save_prepare(GUI_SAVE_LINK_URL, NULL, NULL, url, title);
|
||||
ro_gui_dialog_open_persistent(g->window, dialog_saveas, true);
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user