]> www.fi.muni.cz Git - evince.git/blobdiff - libdocument/ev-document.c
Rename GIRs to EvinceDocument/EvinceView.
[evince.git] / libdocument / ev-document.c
index e9085bea5fd0b72d625ff22e9898f227baa99999..b230b706cf6a08debba59884caee8e796fadb3e6 100644 (file)
@@ -103,7 +103,13 @@ ev_document_fc_mutex_trylock (void)
  * @error: a #GError location to store an error, or %NULL
  *
  * Loads @document from @uri.
- * On failure, @error is filled in.
+ * 
+ * On failure, %FALSE is returned and @error is filled in.
+ * If the document is encrypted, EV_DEFINE_ERROR_ENCRYPTED is returned.
+ * If the backend cannot load the specific document, EV_DOCUMENT_ERROR_INVALID
+ * is returned. Other errors are possible too, depending on the backend
+ * used to load the document and the URI, e.g. #GIOError, #GFileError, and
+ * #GConvertError.
  *
  * Returns: %TRUE on success, or %FALSE on failure.
  */
@@ -114,8 +120,23 @@ ev_document_load (EvDocument  *document,
 {
        EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
        gboolean retval;
-
-       retval = iface->load (document, uri, error);
+       GError *err = NULL;
+
+       retval = iface->load (document, uri, &err);
+       if (!retval) {
+               if (err) {
+                       g_propagate_error (error, err);
+               } else {
+                       g_warning ("%s::EvDocumentIface::load returned FALSE but did not fill in @error; fix the backend!\n",
+                                  G_OBJECT_TYPE_NAME (document));
+
+                       /* So upper layers don't crash */
+                       g_set_error_literal (error,
+                                            EV_DOCUMENT_ERROR,
+                                            EV_DOCUMENT_ERROR_INVALID,
+                                            "Internal error in backend");
+               }
+       }
 
        return retval;
 }