From 047569339406f2be1637ae4cee5dd0c9a9c2328f Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 22 Jan 2014 23:19:57 +0000 Subject: create table for fetcher operations and move all operations into it --- windows/filetype.c | 2 ++ windows/filetype.h | 25 +++++++++++++++++++++++++ windows/gui.c | 15 +++++++++++++-- windows/gui.h | 1 + windows/main.c | 1 + 5 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 windows/filetype.h (limited to 'windows') diff --git a/windows/filetype.c b/windows/filetype.c index 7ad862b8b..5c6485659 100644 --- a/windows/filetype.c +++ b/windows/filetype.c @@ -22,6 +22,8 @@ #include "utils/log.h" #include "utils/utils.h" +#include "windows/filetype.h" + /** * filetype -- determine the MIME type of a local file */ diff --git a/windows/filetype.h b/windows/filetype.h new file mode 100644 index 000000000..e5017eaf4 --- /dev/null +++ b/windows/filetype.h @@ -0,0 +1,25 @@ +/* + * Copyright 2014 Vincent Sanders + * + * This file is part of NetSurf, http://www.netsurf-browser.org/ + * + * NetSurf is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * NetSurf is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef _NETSURF_WINDOWS_FILETYPE_H_ +#define _NETSURF_WINDOWS_FILETYPE_H_ + +const char *fetch_filetype(const char *unix_path); +char *fetch_mimetype(const char *ro_path); + +#endif diff --git a/windows/gui.c b/windows/gui.c index f476c5ae9..a6b2facaf 100644 --- a/windows/gui.c +++ b/windows/gui.c @@ -56,6 +56,7 @@ #include "windows/schedule.h" #include "windows/findfile.h" #include "windows/windbg.h" +#include "windows/filetype.h" HINSTANCE hInstance; /** win32 application instance handle. */ @@ -1868,6 +1869,7 @@ static struct gui_window_table window_table = { struct gui_window_table *win32_window_table = &window_table; + static struct gui_clipboard_table clipboard_table = { .get = gui_get_clipboard, .set = gui_set_clipboard, @@ -1875,10 +1877,19 @@ static struct gui_clipboard_table clipboard_table = { struct gui_clipboard_table *win32_clipboard_table = &clipboard_table; -static struct gui_browser_table browser_table = { - .poll = gui_poll, + +static struct gui_fetch_table fetch_table = { .filename_from_path = filename_from_path, .path_add_part = path_add_part, + .filetype = fetch_filetype, + + .mimetype = fetch_mimetype, +}; +struct gui_fetch_table *win32_fetch_table = &fetch_table; + + +static struct gui_browser_table browser_table = { + .poll = gui_poll, }; struct gui_browser_table *win32_browser_table = &browser_table; diff --git a/windows/gui.h b/windows/gui.h index 3372dcc21..1ff849d73 100644 --- a/windows/gui.h +++ b/windows/gui.h @@ -26,6 +26,7 @@ extern struct gui_window_table *win32_window_table; extern struct gui_clipboard_table *win32_clipboard_table; +extern struct gui_fetch_table *win32_fetch_table; extern struct gui_browser_table *win32_browser_table; extern HINSTANCE hInstance; diff --git a/windows/main.c b/windows/main.c index 8dc9d45cb..ac5231e07 100644 --- a/windows/main.c +++ b/windows/main.c @@ -110,6 +110,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd) .window = win32_window_table, .clipboard = win32_clipboard_table, .download = win32_download_table, + .fetch = win32_fetch_table, }; win32_browser_table->get_resource_url = gui_get_resource_url; -- cgit v1.2.3