+2008-04-24 Jean Baptiste Lallement <jeanbaptiste.lallement@gmail.com>
+
+ * libdocument/ev-document-factory.c (get_mime_type_from_uri),
+ (get_mime_type_from_data), (get_document_from_uri),
+ (ev_document_factory_get_document):
+ Improved error message about file opening failture.
+ Bug #529129.
+
2008-04-24 Abhishek Mukherjee <linkinpark342@gmail.com>
* data/evince-toolbar.xml:
}
static gchar *
-get_mime_type_from_uri (const gchar *uri)
+get_mime_type_from_uri (const gchar *uri, GError **error)
{
GFile *file;
GFileInfo *file_info;
file = g_file_new_for_uri (uri);
file_info = g_file_query_info (file,
G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
- 0, NULL, NULL);
+ 0, NULL, error);
g_object_unref (file);
if (file_info == NULL)
}
static gchar *
-get_mime_type_from_data (const gchar *uri)
+get_mime_type_from_data (const gchar *uri, GError **error)
{
GFile *file;
GFileInputStream *input_stream;
file = g_file_new_for_uri (uri);
- input_stream = g_file_read (file, NULL, NULL);
+ input_stream = g_file_read (file, NULL, error);
if (!input_stream) {
g_object_unref (file);
return NULL;
*compression = EV_COMPRESSION_NONE;
mime_type = slow ?
- get_mime_type_from_data (uri) :
- get_mime_type_from_uri (uri);
+ get_mime_type_from_data (uri, error) :
+ get_mime_type_from_uri (uri, error);
if (mime_type == NULL) {
- g_set_error (error,
- EV_DOCUMENT_ERROR,
- 0,
- _("Unknown MIME Type"));
g_free (mime_type);
return NULL;
g_set_error (error,
EV_DOCUMENT_ERROR,
0,
- _("Unhandled MIME type: ā%sā"), mime_type);
+ _("File type %s (%s) is not supported"),
+ g_content_type_get_description (mime_type),
+ mime_type);
g_free (mime_type);
-
+
return NULL;
}