summaryrefslogtreecommitdiff
path: root/gtk/fetch.c
diff options
context:
space:
mode:
Diffstat (limited to 'gtk/fetch.c')
-rw-r--r--gtk/fetch.c56
1 files changed, 2 insertions, 54 deletions
diff --git a/gtk/fetch.c b/gtk/fetch.c
index c1857ab48..42ba89839 100644
--- a/gtk/fetch.c
+++ b/gtk/fetch.c
@@ -25,9 +25,9 @@
#include <string.h>
#include "utils/hashtable.h"
-#include "utils/url.h"
#include "utils/log.h"
#include "utils/filepath.h"
+#include "utils/file.h"
#include "desktop/gui.h"
#include "gtk/gui.h"
@@ -226,56 +226,10 @@ const char *fetch_filetype(const char *unix_path)
return type;
}
-char *path_to_url(const char *path)
-{
- int urllen;
- char *url;
-
- if (path == NULL) {
- return NULL;
- }
-
- urllen = strlen(path) + FILE_SCHEME_PREFIX_LEN + 1;
-
- url = malloc(urllen);
- if (url == NULL) {
- return NULL;
- }
-
- if (*path == '/') {
- path++; /* file: paths are already absolute */
- }
-
- snprintf(url, urllen, "%s%s", FILE_SCHEME_PREFIX, path);
-
- return url;
-}
-
-
-static char *url_to_path(const char *url)
-{
- char *path;
- char *respath;
- nserror res; /* result from url routines */
-
- res = url_path(url, &path);
- if (res != NSERROR_OK) {
- return NULL;
- }
-
- res = url_unescape(path, &respath);
- free(path);
- if (res != NSERROR_OK) {
- return NULL;
- }
-
- return respath;
-}
static nsurl *gui_get_resource_url(const char *path)
{
char buf[PATH_MAX];
- char *raw;
nsurl *url = NULL;
/* default.css -> gtkdefault.css */
@@ -288,19 +242,13 @@ static nsurl *gui_get_resource_url(const char *path)
path = "favicon.png";
}
- raw = path_to_url(filepath_sfind(respaths, buf, path));
- if (raw != NULL) {
- nsurl_create(raw, &url);
- free(raw);
- }
+ netsurf_path_to_nsurl(filepath_sfind(respaths, buf, path), &url);
return url;
}
static struct gui_fetch_table fetch_table = {
.filetype = fetch_filetype,
- .path_to_url = path_to_url,
- .url_to_path = url_to_path,
.get_resource_url = gui_get_resource_url,
};