]> www.fi.muni.cz Git - evince.git/blobdiff - libdocument/ev-document-factory.c
Updated Lithuanian translation.
[evince.git] / libdocument / ev-document-factory.c
index 328ff74326083b7d2e6e6448b2b9fb1a846edb8e..a920be60bcfe06e2a051866700212b29160a7639 100644 (file)
@@ -23,6 +23,7 @@
 #endif
 
 #include <string.h>
+
 #include <gio/gio.h>
 #include <glib/gstdio.h>
 #include <glib/gi18n.h>
@@ -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;