X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;ds=inline;f=backend%2Fev-document-factory.c;h=3b3f701a5ce6edf54aa5f7100ab9f833e1705614;hb=ddd3af422a32a56bdf0ae88c3f704b40776e9ede;hp=278a21a1be1976a4531d5b55c620fffc8dc48139;hpb=a554f8e3595152cd2afa33c6a2a368f6469509de;p=evince.git diff --git a/backend/ev-document-factory.c b/backend/ev-document-factory.c index 278a21a1..3b3f701a 100644 --- a/backend/ev-document-factory.c +++ b/backend/ev-document-factory.c @@ -296,15 +296,21 @@ ev_document_factory_get_document (const char *uri, GError **error) } result = ev_document_load (document, uri, error); - + if (result == FALSE || *error) { - if (document) - g_object_unref (document); - document = NULL; + if (*error && + (*error)->domain == EV_DOCUMENT_ERROR && + (*error)->code == EV_DOCUMENT_ERROR_ENCRYPTED) + return document; } else { return document; } + /* Try again with slow mime detection */ + if (document) + g_object_unref (document); + document = NULL; + if (*error) g_error_free (*error); *error = NULL; @@ -316,20 +322,23 @@ ev_document_factory_get_document (const char *uri, GError **error) } result = ev_document_load (document, uri, error); - - if (result == FALSE || *error) { + + if (result == FALSE) { + if (*error == NULL) { + g_set_error (error, + EV_DOCUMENT_ERROR, + 0, + _("Unknown MIME Type")); + } else if ((*error)->domain == EV_DOCUMENT_ERROR && + (*error)->code == EV_DOCUMENT_ERROR_ENCRYPTED) { + return document; + } + if (document) g_object_unref (document); document = NULL; } - - if (result == FALSE && *error == NULL) { - g_set_error (error, - EV_DOCUMENT_ERROR, - 0, - _("Unknown MIME Type")); - } - + return document; }