X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;ds=sidebyside;f=backend%2Fev-document-factory.c;h=78be656cf1ff0cb7f9e6095321f1f22bba103da1;hb=592bc46cb8c4d56dd04c39ac87d287a0abcf6fa6;hp=3b3f701a5ce6edf54aa5f7100ab9f833e1705614;hpb=2409a4e2aba8f8c83365492f44e8c3c801b852f8;p=evince.git diff --git a/backend/ev-document-factory.c b/backend/ev-document-factory.c index 3b3f701a..78be656c 100644 --- a/backend/ev-document-factory.c +++ b/backend/ev-document-factory.c @@ -26,22 +26,28 @@ /* The various document type backends: */ #include "ev-poppler.h" -#include "pixbuf-document.h" -#include "tiff-document.h" -#include "impress-document.h" #ifdef ENABLE_PS #include "ps-document.h" #endif +#ifdef ENABLE_TIFF +#include "tiff-document.h" +#endif #ifdef ENABLE_DVI #include "dvi-document.h" #endif +#ifdef ENABLE_PIXBUF +#include "pixbuf-document.h" +#endif #ifdef ENABLE_DJVU #include "djvu-document.h" #endif #ifdef ENABLE_COMICS #include "comics-document.h" #endif +#ifdef ENABLE_IMPRESS +#include "impress-document.h" +#endif #include #include @@ -59,8 +65,10 @@ struct _EvDocumentType }; const EvDocumentType document_types[] = { +#ifdef ENABLE_PDF /* PDF: */ {"application/pdf", EV_BACKEND_PDF, pdf_document_get_type}, +#endif #ifdef ENABLE_PS /* Postscript: */ @@ -69,11 +77,6 @@ const EvDocumentType document_types[] = { {"image/x-eps", EV_BACKEND_PS, ps_document_get_type}, #endif -#ifdef ENABLE_IMPRESS - /* Impress slides: */ - {"application/vnd.sun.xml.impress", EV_BACKEND_IMPRESS, impress_document_get_type}, -#endif - #ifdef ENABLE_TIFF /* Tiff: */ {"image/tiff", EV_BACKEND_TIFF, tiff_document_get_type}, @@ -94,6 +97,13 @@ const EvDocumentType document_types[] = { {"application/x-cbr", EV_BACKEND_COMICS, comics_document_get_type}, {"application/x-cbz", EV_BACKEND_COMICS, comics_document_get_type}, #endif + +#ifdef ENABLE_IMPRESS + /* Impress slides: */ + {"application/vnd.sun.xml.impress", EV_BACKEND_IMPRESS, impress_document_get_type}, + {"application/vnd.oasis.opendocument.presentation", EV_BACKEND_IMPRESS, impress_document_get_type}, +#endif + }; #ifdef ENABLE_PIXBUF @@ -291,21 +301,19 @@ ev_document_factory_get_document (const char *uri, GError **error) document = get_document_from_uri (uri, FALSE, error); - if (*error != NULL) { - return NULL; - } - - result = ev_document_load (document, uri, error); + if (*error == NULL) { + result = ev_document_load (document, uri, error); - if (result == FALSE || *error) { - if (*error && - (*error)->domain == EV_DOCUMENT_ERROR && - (*error)->code == EV_DOCUMENT_ERROR_ENCRYPTED) + if (result == FALSE || *error) { + if (*error && + (*error)->domain == EV_DOCUMENT_ERROR && + (*error)->code == EV_DOCUMENT_ERROR_ENCRYPTED) + return document; + } else { return document; - } else { - return document; + } } - + /* Try again with slow mime detection */ if (document) g_object_unref (document); @@ -384,6 +392,7 @@ ev_document_factory_add_filters (GtkWidget *chooser, EvDocument *document) } #endif +#ifdef ENABLE_PDF if (document == NULL || backend == EV_BACKEND_PDF) { default_filter = filter = gtk_file_filter_new (); gtk_file_filter_set_name (filter, _("PDF Documents")); @@ -391,6 +400,7 @@ ev_document_factory_add_filters (GtkWidget *chooser, EvDocument *document) file_filter_add_mime_list_and_free (filter, mime_types); gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), filter); } +#endif #ifdef ENABLE_PIXBUF if (document == NULL || backend == EV_BACKEND_PIXBUF) {