X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=backend%2Fev-document-factory.c;h=23364a2db1f5cdddc1a980a8104fba09bf1ad06b;hb=1a9964cbdc190840aa6ea2d762be1b8132d3dcbb;hp=c02801fbc1aff16c2eec45b74afd082a61309711;hpb=a4a3a2301361cb6a71e1b127e8e43589f2749105;p=evince.git diff --git a/backend/ev-document-factory.c b/backend/ev-document-factory.c index c02801fb..23364a2d 100644 --- a/backend/ev-document-factory.c +++ b/backend/ev-document-factory.c @@ -28,6 +28,8 @@ #include "ev-poppler.h" #include "pixbuf-document.h" #include "tiff-document.h" +#include "impress-document.h" + #ifdef ENABLE_PS #include "ps-document.h" #endif @@ -67,6 +69,11 @@ 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}, @@ -259,14 +266,14 @@ get_document_from_uri (const char *uri, gboolean slow, GError **error) gnome_vfs_file_info_unref (info); return NULL; } - + document = ev_document_factory_get_from_mime (info->mime_type); if (document == NULL) { g_set_error (error, EV_DOCUMENT_ERROR, 0, - _("Unhandled MIME type: '%s'"), info->mime_type); + _("Unhandled MIME type: “%s”"), info->mime_type); gnome_vfs_file_info_unref (info); return NULL; } @@ -280,18 +287,18 @@ EvDocument * ev_document_factory_get_document (const char *uri, GError **error) { EvDocument *document; - + document = get_document_from_uri (uri, FALSE, error); - if (*error != NULL) { - return NULL; + if (*error == NULL) { + ev_document_load (document, uri, error); } - - ev_document_load (document, uri, error); - + if (*error) { g_error_free (*error); *error = NULL; + } else { + return document; } document = get_document_from_uri (uri, TRUE, error); @@ -395,6 +402,16 @@ ev_document_factory_add_filters (GtkWidget *chooser, EvDocument *document) } #endif +#ifdef ENABLE_IMPRESS + if (document == NULL || backend == EV_BACKEND_IMPRESS) { + default_filter = filter = gtk_file_filter_new (); + gtk_file_filter_set_name (filter, _("Impress Slides")); + mime_types = ev_document_factory_get_mime_types (EV_BACKEND_IMPRESS); + file_filter_add_mime_list_and_free (filter, mime_types); + gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), filter); + } +#endif + filter = gtk_file_filter_new (); gtk_file_filter_set_name (filter, _("All Files")); gtk_file_filter_add_pattern (filter, "*");