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 --- framebuffer/filetype.c | 2 ++ framebuffer/filetype.h | 25 +++++++++++++++++++++++++ framebuffer/gui.c | 16 ++++++++++++---- 3 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 framebuffer/filetype.h (limited to 'framebuffer') diff --git a/framebuffer/filetype.c b/framebuffer/filetype.c index 84e286d0c..ce71e337a 100644 --- a/framebuffer/filetype.c +++ b/framebuffer/filetype.c @@ -22,6 +22,8 @@ #include "utils/log.h" #include "utils/utils.h" +#include "framebuffer/filetype.h" + /** * filetype -- determine the MIME type of a local file */ diff --git a/framebuffer/filetype.h b/framebuffer/filetype.h new file mode 100644 index 000000000..d11aacb5b --- /dev/null +++ b/framebuffer/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_FB_FILETYPE_H +#define NETSURF_FB_FILETYPE_H + +const char *fetch_filetype(const char *unix_path); +char *fetch_mimetype(const char *ro_path); + +#endif diff --git a/framebuffer/gui.c b/framebuffer/gui.c index d89315957..82af56d9e 100644 --- a/framebuffer/gui.c +++ b/framebuffer/gui.c @@ -1,5 +1,5 @@ /* - * Copyright 2008 Vincent Sanders + * Copyright 2008, 2014 Vincent Sanders * * This file is part of NetSurf, http://www.netsurf-browser.org/ * @@ -55,6 +55,7 @@ #include "framebuffer/image_data.h" #include "framebuffer/font.h" #include "framebuffer/clipboard.h" +#include "framebuffer/filetype.h" #include "content/urldb.h" #include "desktop/local_history.h" @@ -1824,13 +1825,19 @@ static struct gui_window_table framebuffer_window_table = { .stop_throbber = gui_window_stop_throbber, }; -static struct gui_browser_table framebuffer_browser_table = { - .poll = gui_poll, +static struct gui_fetch_table framebuffer_fetch_table = { .filename_from_path = filename_from_path, .path_add_part = path_add_part, + .filetype = fetch_filetype, - .quit = gui_quit, .get_resource_url = gui_get_resource_url, + .mimetype = fetch_mimetype, +}; + +static struct gui_browser_table framebuffer_browser_table = { + .poll = gui_poll, + + .quit = gui_quit, }; /** Entry point from OS. @@ -1852,6 +1859,7 @@ main(int argc, char** argv) .browser = &framebuffer_browser_table, .window = &framebuffer_window_table, .clipboard = framebuffer_clipboard_table, + .fetch = &framebuffer_fetch_table, }; respaths = fb_init_resource(NETSURF_FB_RESPATH":"NETSURF_FB_FONTPATH); -- cgit v1.2.3