Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@src.gnome.org>2009-02-15 13:52:14 (GMT)
committer Christian Persch <chpe@src.gnome.org>2009-02-15 13:52:14 (GMT)
commit072f3fb81ec13ce138e35e8ae14221f4dd4ec21b (patch)
treed038942ae95c4b9c4b678c078e3c5587e24a8fd2
parent1098190ff666909329901121e8825071974085f0 (diff)
Document that this returns either NULL and fills in error, or non-NULL.
* libdocument/ev-document-factory.c: (get_document_from_uri): Document that this returns either NULL and fills in error, or non-NULL. Use a local GError so we can reliably check it. svn path=/trunk/; revision=3445
-rw-r--r--ChangeLog6
-rw-r--r--libdocument/ev-document-factory.c22
2 files changed, 26 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 83af467..55d9184 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2009-02-14 Christian Persch <chpe@gnome.org>
+ * libdocument/ev-document-factory.c: (get_document_from_uri): Document
+ that this returns either NULL and fills in error, or non-NULL. Use a
+ local GError so we can reliably check it.
+
+2009-02-14 Christian Persch <chpe@gnome.org>
+
* libdocument/ev-document-factory.c: (get_document_from_uri): Use the
content type to get the description, not the MIME type.
diff --git a/libdocument/ev-document-factory.c b/libdocument/ev-document-factory.c
index f0172ff..575dfb9 100644
--- a/libdocument/ev-document-factory.c
+++ b/libdocument/ev-document-factory.c
@@ -104,6 +104,21 @@ get_compression_from_mime_type (const gchar *mime_type)
return EV_COMPRESSION_NONE;
}
+
+/*
+ * get_document_from_uri:
+ * @uri: the document URI
+ * @fast: whether to use fast MIME type detection
+ * @compression: return location to store the document's compression type
+ * @error: a #GError location to store an error, or %NULL
+ *
+ * Creates a #EvDocument instance for the document at @uri, using either
+ * fast or slow MIME type detection. If a document could be created,
+ * @compression is filled in with the document's compression type.
+ * On error, %NULL is returned and @error filled in.
+ *
+ * Returns: a new #EvDocument instance, or %NULL on error
+ */
static EvDocument *
get_document_from_uri (const char *uri,
gboolean fast,
@@ -112,19 +127,22 @@ get_document_from_uri (const char *uri,
{
EvDocument *document = NULL;
gchar *mime_type = NULL;
+ GError *err = NULL;
*compression = EV_COMPRESSION_NONE;
- mime_type = ev_file_get_mime_type (uri, fast, error);
+ mime_type = ev_file_get_mime_type (uri, fast, &err);
if (mime_type == NULL) {
g_free (mime_type);
- if (*error == NULL) {
+ if (err == NULL) {
g_set_error_literal (error,
EV_DOCUMENT_ERROR,
EV_DOCUMENT_ERROR_INVALID,
_("Unknown MIME Type"));
+ } else {
+ g_propagate_error (error, err);
}
return NULL;