X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;ds=sidebyside;f=shell%2Fev-document-types.c;h=b39cfd7d0fce24785e84bdaae82913f6122a6b12;hb=d395ea58afa6744be92e33193881a1d4e6aeefed;hp=cc7734f12ad95b5ab84a2880c7e1615c78ee0852;hpb=f332d42bc834d6a7b0ec58bb8e073e63bc619f63;p=evince.git diff --git a/shell/ev-document-types.c b/shell/ev-document-types.c index cc7734f1..b39cfd7d 100644 --- a/shell/ev-document-types.c +++ b/shell/ev-document-types.c @@ -27,6 +27,7 @@ /* The various document type backends: */ #include "ev-poppler.h" #include "pixbuf-document.h" +#include "tiff-document.h" #include "ps-document.h" #ifdef ENABLE_DVI #include "dvi-document.h" @@ -36,6 +37,9 @@ #endif #include +#include +#include +#include typedef struct _EvDocumentType EvDocumentType; struct _EvDocumentType @@ -53,9 +57,12 @@ const EvDocumentType document_types[] = { {"application/x-gzpostscript", ps_document_get_type}, {"image/x-eps", ps_document_get_type}, + /* Tiff: */ + {"image/tiff", tiff_document_get_type}, + #ifdef ENABLE_DJVU /* djvu: */ - {"image/vnd.djvu", djvu_document_get_type), + {"image/vnd.djvu", djvu_document_get_type}, #endif #ifdef ENABLE_DVI @@ -102,16 +109,36 @@ mime_type_supported_by_gdk_pixbuf (const gchar *mime_type) return retval; } -GType -ev_document_type_lookup (const char *mime_type) +static char * +get_slow_mime_type (const char *uri) { - int i; + GnomeVFSFileInfo *info; + char *mime_type; + GnomeVFSResult result; + + info = gnome_vfs_file_info_new (); + result = gnome_vfs_get_file_info (uri, info, + GNOME_VFS_FILE_INFO_GET_MIME_TYPE | + GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE | + GNOME_VFS_FILE_INFO_FOLLOW_LINKS); + if (info->mime_type == NULL || result != GNOME_VFS_OK) { + mime_type = NULL; + } else { + mime_type = g_strdup (info->mime_type); + } + gnome_vfs_file_info_unref (info); + + return mime_type; +} - g_return_val_if_fail (mime_type, G_TYPE_INVALID); +static GType +get_document_type_from_mime (const char *mime_type) +{ + int i; - for (i=0;i