Register additional MIME types for DataTypes

Default file contains all image MIME Types NetSurf is capable of handling natively
(plus JPEG2000) to ensure disabling features in NetSurf won't lose support.


svn path=/trunk/netsurf/; revision=12287
This commit is contained in:
Chris Young 2011-05-07 11:09:23 +00:00
parent 0cc1dade3c
commit 27d4350054
3 changed files with 91 additions and 0 deletions

View File

@ -33,6 +33,7 @@
#include "utils/talloc.h"
#include <proto/datatypes.h>
#include <proto/DOS.h>
#include <proto/intuition.h>
#include <datatypes/pictureclass.h>
#include <intuition/classusr.h>
@ -90,6 +91,7 @@ nserror amiga_dt_picture_init(void)
lwc_string *type;
lwc_error lerror;
nserror error;
BPTR fh = 0;
while((dt = ObtainDataType(DTST_RAM, NULL,
DTA_DataType, prevdt,
@ -118,6 +120,28 @@ nserror amiga_dt_picture_init(void)
ReleaseDataType(prevdt);
if(fh = FOpen("PROGDIR:Resources/MIME/dt.picture", MODE_OLDFILE, 0))
{
while(FGets(fh, &dt_mime, 50) != 0)
{
dt_mime[strlen(dt_mime) - 1] = '\0';
if((dt_mime[0] == '\0') || (dt_mime[0] == '#'))
continue; /* Skip blank lines and comments */
lerror = lwc_intern_string(dt_mime, strlen(dt_mime), &type);
if (lerror != lwc_error_ok)
return NSERROR_NOMEM;
error = content_factory_register_handler(type,
&amiga_dt_picture_content_handler);
lwc_string_unref(type);
if (error != NSERROR_OK)
return error;
}
FClose(fh);
}
return NSERROR_OK;
}

View File

@ -19,3 +19,4 @@ makelink Pointers /amiga/resources/Pointers soft
makelink quirks.css /!NetSurf/Resources/Quirks,f79 soft
makelink SearchEngines /amiga/resources/SearchEngines soft
makelink Themes /amiga/resources/Themes soft
makelink MIME /amiga/resources/MIME soft

View File

@ -0,0 +1,66 @@
# This file contains a list of MIME types that can be handled by
# picture class datatypes (subclasses of picture.datatype)
#
# It does not matter if this file contains MIME Types for formats
# that a DataType is not installed for, unless a different
# subclass handles this type.
# BMP
application/bmp
application/preview
application/x-bmp
application/x-win-bitmap
image/bmp
image/ms-bmp
image/x-bitmap
image/x-bmp
image/x-ms-bmp
image/x-win-bitmap
image/x-windows-bmp
image/x-xbitmap
# GIF
# Expect this to cause problems with GIF anims if GIFANIM datatype installed
image/gif
# ICO
application/ico
application/x-ico
image/ico
image/vnd.microsoft.icon
image/x-icon
# .info
image/x-amiga-icon
# JNG
image/jng
image/x-jng
# JPEG
image/jpeg
image/jpg
image/pjpeg
# JPEG2000
image/jp2
image/jpeg2000
# MNG
image/mng
image/x-mng
video/mng
video/x-mng
# PNG
image/png
# RISC OS Sprite
image/x-riscos-sprite
# SVG
image/svg
image/svg+xml
# WebP
image/webp