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=f8a3a4b8f7584496e144f464fa228c8c90d72d6e;hb=3975d110064cd88af69d393f956f8158aae1878f;hp=c7314ecffe28af832cc38305e10db6690117e3b0;hpb=67a923a1096f1e9765a5d804e4fb9fac39bcfcf2;p=evince.git diff --git a/backend/ev-document-factory.c b/backend/ev-document-factory.c index c7314ecf..f8a3a4b8 100644 --- a/backend/ev-document-factory.c +++ b/backend/ev-document-factory.c @@ -142,7 +142,7 @@ mime_type_supported_by_gdk_pixbuf (const gchar *mime_type) } #endif -EvDocument* +static EvDocument* ev_document_factory_get_from_mime (const char *mime_type) { int i; @@ -230,7 +230,7 @@ ev_document_factory_get_all_mime_types (void) } static EvDocument * -get_document_from_uri (const char *uri, gboolean slow, gchar **mime_type, GError **error) +get_document_from_uri (const char *uri, gboolean slow, GError **error) { EvDocument *document = NULL; @@ -259,7 +259,7 @@ get_document_from_uri (const char *uri, gboolean slow, gchar **mime_type, GError gnome_vfs_file_info_unref (info); return NULL; } - + document = ev_document_factory_get_from_mime (info->mime_type); if (document == NULL) { @@ -271,32 +271,36 @@ get_document_from_uri (const char *uri, gboolean slow, gchar **mime_type, GError return NULL; } - if (mime_type != NULL) { - *mime_type = g_strdup (info->mime_type); - } - gnome_vfs_file_info_unref (info); return document; } EvDocument * -ev_document_factory_get_document (const char *uri, gchar **mime_type, GError **error) +ev_document_factory_get_document (const char *uri, GError **error) { EvDocument *document; - - document = get_document_from_uri (uri, FALSE, mime_type, error); - if (document != NULL) { - return document; + document = get_document_from_uri (uri, FALSE, error); + + if (*error == NULL) { + ev_document_load (document, uri, error); } - - if (error) { + + if (*error) { g_error_free (*error); *error = NULL; + } else { + return document; + } + + document = get_document_from_uri (uri, TRUE, error); + + if (*error != NULL) { + return NULL; } - document = get_document_from_uri (uri, TRUE, mime_type, error); + ev_document_load (document, uri, error); return document; }