static void ev_document_initialize_synctex (EvDocument *document, const gchar *uri) { EvDocumentPrivate *priv = document->priv; if (_ev_document_support_synctex (document)) { gchar *filename; filename = g_filename_from_uri (uri, NULL, NULL); if (filename != NULL) { priv->synctex_scanner = synctex_scanner_new_with_output_file (filename, NULL, 1); g_free (filename); } } }
/** * ev_document_load: * @document: a #EvDocument * @uri: the document's URI * @error: a #GError location to store an error, or %NULL * * Loads @document from @uri. * * 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. */ gboolean ev_document_load (EvDocument *document, const char *uri, GError **error) { EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS (document); gboolean retval; GError *err = NULL; retval = klass->load (document, uri, &err); if (!retval) { if (err) { g_propagate_error (error, err); } else { g_warning ("%s::EvDocument::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"); } } else { EvDocumentPrivate *priv = document->priv; ev_document_setup_cache (document); priv->uri = g_strdup (uri); priv->info = _ev_document_get_info (document); if (_ev_document_support_synctex (document)) { gchar *filename; filename = g_filename_from_uri (uri, NULL, NULL); if (filename != NULL) { priv->synctex_scanner = synctex_scanner_new_with_output_file (filename, NULL, 1); g_free (filename); } } } return retval; }