mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-22 22:41:30 +03:00
convert from mimetype to filetype rather than simple content type to filetype, where
available svn path=/trunk/netsurf/; revision=12484
This commit is contained in:
parent
26101a1af6
commit
790bdf2e2a
@ -66,7 +66,7 @@ void gui_drag_save_object(gui_save_type type, hlcache_handle *c,
|
||||
{
|
||||
case GUI_SAVE_OBJECT_ORIG: // object
|
||||
case GUI_SAVE_SOURCE:
|
||||
filetype = ami_content_type_to_file_type(content_get_type(c));
|
||||
filetype = ami_mime_content_to_filetype(c);
|
||||
break;
|
||||
case GUI_SAVE_COMPLETE:
|
||||
filetype = "drawer";
|
||||
|
@ -148,8 +148,6 @@ char *fetch_mimetype(const char *ro_path)
|
||||
|
||||
const char *ami_content_type_to_file_type(content_type type)
|
||||
{
|
||||
/* TODO: Can we pass MIME types to this function instead? */
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case CONTENT_HTML:
|
||||
@ -164,6 +162,10 @@ const char *ami_content_type_to_file_type(content_type type)
|
||||
return "css";
|
||||
break;
|
||||
|
||||
case CONTENT_IMAGE:
|
||||
return "picture";
|
||||
break;
|
||||
|
||||
default:
|
||||
return "project";
|
||||
break;
|
||||
@ -252,6 +254,7 @@ nserror ami_mime_init(const char *mimefile)
|
||||
|
||||
void ami_mime_free(void)
|
||||
{
|
||||
ami_mime_dump();
|
||||
FreeObjList(ami_mime_list);
|
||||
}
|
||||
|
||||
@ -508,6 +511,22 @@ struct Node *ami_mime_to_filetype(lwc_string *mimetype,
|
||||
}
|
||||
}
|
||||
|
||||
const char *ami_mime_content_to_filetype(struct hlcache_handle *c)
|
||||
{
|
||||
struct Node *node;
|
||||
lwc_string *filetype;
|
||||
lwc_string *mimetype;
|
||||
|
||||
mimetype = content_get_mime_type(c);
|
||||
|
||||
node = ami_mime_to_filetype(mimetype, &filetype, NULL);
|
||||
|
||||
if(node && (filetype != NULL))
|
||||
return lwc_string_data(filetype);
|
||||
else
|
||||
return ami_content_type_to_file_type(content_get_type(c));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all MIME types containing a plugincmd
|
||||
*
|
||||
|
@ -37,7 +37,9 @@ struct Node *ami_mime_from_datatype(struct DataType *dt,
|
||||
struct Node *ami_mime_to_filetype(lwc_string *mimetype,
|
||||
lwc_string **filetype, struct Node *start_node);
|
||||
|
||||
const char *ami_mime_content_to_filetype(struct hlcache_handle *c);
|
||||
lwc_string *ami_mime_content_to_cmd(struct hlcache_handle *c);
|
||||
|
||||
struct Node *ami_mime_has_cmd(lwc_string **mimetype, struct Node *start_node);
|
||||
|
||||
bool ami_mime_compare(struct hlcache_handle *c, const char *type);
|
||||
|
Loading…
Reference in New Issue
Block a user