summaryrefslogtreecommitdiff
path: root/desktop/gui.h
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2014-01-22 23:19:57 +0000
committerVincent Sanders <vince@kyllikki.org>2014-01-23 00:00:18 +0000
commit047569339406f2be1637ae4cee5dd0c9a9c2328f (patch)
tree3d3909b4bc3d27cd7a9e146d32539ce752b33310 /desktop/gui.h
parent4684e9665d2ddff50f4a8e9a16d73224d2617180 (diff)
downloadnetsurf-047569339406f2be1637ae4cee5dd0c9a9c2328f.tar.gz
netsurf-047569339406f2be1637ae4cee5dd0c9a9c2328f.tar.bz2
create table for fetcher operations and move all operations into it
Diffstat (limited to 'desktop/gui.h')
-rw-r--r--desktop/gui.h84
1 files changed, 63 insertions, 21 deletions
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.
@@ -340,6 +338,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
*/
void (*launch_url)(const char *url);
@@ -380,6 +419,9 @@ struct gui_table {
/** Clipboard table */
struct gui_clipboard_table *clipboard;
+
+ /** Fetcher table */
+ struct gui_fetch_table *fetch;
};