From 835d033e7b0c37883c05ab0c66086d089ababd26 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sat, 30 Oct 2010 14:23:38 +0000 Subject: Amiga icon loader. Treeviews will now use the user's icons for content types. svn path=/trunk/netsurf/; revision=10925 --- amiga/filetype.c | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) (limited to 'amiga/filetype.c') diff --git a/amiga/filetype.c b/amiga/filetype.c index 790a2404a..68ccca0bc 100644 --- a/amiga/filetype.c +++ b/amiga/filetype.c @@ -41,20 +41,33 @@ const char *fetch_filetype(const char *unix_path) struct DataType *dtn; BOOL found = FALSE; - /* First try getting a tooltype "MIMETYPE" and use that as the MIME type. Will fail over - to default icons if the file doesn't have a real icon. */ + /* First, check if we appear to have an icon. + We'll just do a filename check here for quickness, although the + first word ought to be checked against WB_DISKMAGIC really. */ - if(dobj = GetIconTags(unix_path,ICONGETA_FailIfUnavailable,FALSE, - TAG_DONE)) + if(strncmp(unix_path + strlen(unix_path) - 5, ".info", 5) == 0) { - ttype = FindToolType(dobj->do_ToolTypes, "MIMETYPE"); - if(ttype) + strcpy(mimetype,"image/x-amiga-icon"); + found = TRUE; + } + + /* Secondly try getting a tooltype "MIMETYPE" and use that as the MIME type. + Will fail over to default icons if the file doesn't have a real icon. */ + + if(!found) + { + if(dobj = GetIconTags(unix_path,ICONGETA_FailIfUnavailable,FALSE, + TAG_DONE)) { - strcpy(mimetype,ttype); - found = TRUE; - } + ttype = FindToolType(dobj->do_ToolTypes, "MIMETYPE"); + if(ttype) + { + strcpy(mimetype,ttype); + found = TRUE; + } - FreeDiskObject(dobj); + FreeDiskObject(dobj); + } } /* If that didn't work, have a go at guessing it using datatypes.library. This isn't @@ -190,6 +203,11 @@ const char *ami_content_type_to_file_type(content_type type) case CONTENT_SVG: return "svg"; break; +#endif +#ifdef WITH_WEBP + case CONTENT_WEBP: + return "webp"; + break; #endif default: return "project"; -- cgit v1.2.3