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 --- desktop/gui.h | 84 ++++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 63 insertions(+), 21 deletions(-) (limited to 'desktop/gui.h') diff --git a/desktop/gui.h b/desktop/gui.h index 5252737f9..724355d10 100644 --- a/desktop/gui.h +++ b/desktop/gui.h @@ -280,23 +280,17 @@ struct gui_clipboard_table { void (*set)(const char *buffer, size_t length, nsclipboard_styles styles[], int n_styles); }; -/** Graphical user interface browser misc function table - * - * function table implementing GUI interface to miscelaneous browser - * functionality +/** + * function table for fetcher operations */ -struct gui_browser_table { +struct gui_fetch_table { /* Mandantory entries */ - /** - * called to let the frontend update its state and run any - * I/O operations. - */ - void (*poll)(bool active); - /** * Return the filename part of a full path * + * @note used in curl fetcher + * * \param path full path and filename * \return filename (will be freed with free()) */ @@ -305,6 +299,8 @@ struct gui_browser_table { /** * Add a path component/filename to an existing path * + * @note used in save complete and file fetcher + * * \param path buffer containing path + free space * \param length length of buffer "path" * \param newpart string containing path component to add to path @@ -312,23 +308,25 @@ struct gui_browser_table { */ bool (*path_add_part)(char *path, int length, const char *newpart); - /* Optional entries */ - - /** called to allow the gui to cleanup */ - void (*quit)(void); - /** - * set gui display of a retrieved favicon representing the - * search provider + * Determine the MIME type of a local file. * - * \param ico may be NULL for local calls; then access current - * cache from search_web_ico() + * @note used in file fetcher + * + * \param unix_path Unix style path to file on disk + * \return Pointer to MIME type string (should not be freed) - + * invalidated on next call to fetch_filetype. */ - void (*set_search_ico)(hlcache_handle *ico); + const char *(*filetype)(const char *unix_path); + + + /* Optional entries */ /** * Callback to translate resource to full url. * + * @note used in resource fetcher + * * Transforms a resource: path into a full URL. The returned URL * is used as the target for a redirect. The caller takes ownership of * the returned nsurl including unrefing it when finished with it. @@ -339,6 +337,47 @@ struct gui_browser_table { */ nsurl* (*get_resource_url)(const char *path); + /** + * Find a MIME type for a local file + * + * @note used in file fetcher + * + * \param ro_path RISC OS style path to file on disk + * \return MIME type string (on heap, caller should free), or NULL + */ + char *(*mimetype)(const char *ro_path); + +}; + +/** Graphical user interface browser misc function table + * + * function table implementing GUI interface to miscelaneous browser + * functionality + */ +struct gui_browser_table { + /* Mandantory entries */ + + /** + * called to let the frontend update its state and run any + * I/O operations. + */ + void (*poll)(bool active); + + + /* Optional entries */ + + /** called to allow the gui to cleanup */ + void (*quit)(void); + + /** + * set gui display of a retrieved favicon representing the + * search provider + * + * \param ico may be NULL for local calls; then access current + * cache from search_web_ico() + */ + void (*set_search_ico)(hlcache_handle *ico); + /** * core has no fetcher for url */ @@ -380,6 +419,9 @@ struct gui_table { /** Clipboard table */ struct gui_clipboard_table *clipboard; + + /** Fetcher table */ + struct gui_fetch_table *fetch; }; -- cgit v1.2.3