diff options
author | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2010-10-30 14:23:38 +0000 |
---|---|---|
committer | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2010-10-30 14:23:38 +0000 |
commit | 835d033e7b0c37883c05ab0c66086d089ababd26 (patch) | |
tree | 8a305d608aec7b06768ef46b9116c111ae38ae1d /amiga/filetype.c | |
parent | 22c31c63492ed051faf7b313158b8466d4812ce1 (diff) | |
download | netsurf-835d033e7b0c37883c05ab0c66086d089ababd26.tar.gz netsurf-835d033e7b0c37883c05ab0c66086d089ababd26.tar.bz2 |
Amiga icon loader. Treeviews will now use the user's icons for content types.
svn path=/trunk/netsurf/; revision=10925
Diffstat (limited to 'amiga/filetype.c')
-rw-r--r-- | amiga/filetype.c | 38 |
1 files changed, 28 insertions, 10 deletions
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 @@ -191,6 +204,11 @@ const char *ami_content_type_to_file_type(content_type type) return "svg"; break; #endif +#ifdef WITH_WEBP + case CONTENT_WEBP: + return "webp"; + break; +#endif default: return "project"; break; |