X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=libdocument%2Fev-document-factory.c;h=a920be60bcfe06e2a051866700212b29160a7639;hb=13948dea9658bd64604cd71d8913583afb88776a;hp=328ff74326083b7d2e6e6448b2b9fb1a846edb8e;hpb=86ad3e544e48530873357a1c112669b734ab988a;p=evince.git diff --git a/libdocument/ev-document-factory.c b/libdocument/ev-document-factory.c index 328ff743..a920be60 100644 --- a/libdocument/ev-document-factory.c +++ b/libdocument/ev-document-factory.c @@ -23,6 +23,7 @@ #endif #include + #include #include #include @@ -143,7 +144,7 @@ get_mime_type_from_data (const gchar *uri, GError **error) size_read = g_input_stream_read (G_INPUT_STREAM (input_stream), buffer, 1024, NULL, NULL); - g_input_stream_close (G_INPUT_STREAM (input_stream), NULL, NULL); + g_input_stream_close (G_INPUT_STREAM (input_stream), NULL, error); g_object_unref (file); @@ -172,6 +173,13 @@ get_document_from_uri (const char *uri, if (mime_type == NULL) { g_free (mime_type); + + if (*error == NULL) { + g_set_error (error, + EV_DOCUMENT_ERROR, + 0, + _("Unknown MIME Type")); + } return NULL; } @@ -184,12 +192,15 @@ get_document_from_uri (const char *uri, #endif /* ENABLE_PIXBUF */ if (document == NULL) { + gchar *mime_desc; + + mime_desc = g_content_type_get_description (mime_type); g_set_error (error, EV_DOCUMENT_ERROR, 0, _("File type %s (%s) is not supported"), - g_content_type_get_description (mime_type), - mime_type); + mime_desc, mime_type); + g_free (mime_desc); g_free (mime_type); return NULL;