[evince] libdocument: Cache also the uri and document info when loading from a GFile
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] libdocument: Cache also the uri and document info when loading from a GFile
- Date: Wed, 24 Jul 2013 11:09:46 +0000 (UTC)
commit 3094259aa75b1be2fbf1ff598050f8f4f9eadad3
Author: Alessandro Campagni <alessandro campagni gmail com>
Date: Wed Jul 24 12:27:21 2013 +0200
libdocument: Cache also the uri and document info when loading from a GFile
https://bugzilla.gnome.org/show_bug.cgi?id=704685
libdocument/ev-document.c | 38 +++++++++++++++++++++++---------------
1 files changed, 23 insertions(+), 15 deletions(-)
---
diff --git a/libdocument/ev-document.c b/libdocument/ev-document.c
index f9ae206..3be4f6f 100644
--- a/libdocument/ev-document.c
+++ b/libdocument/ev-document.c
@@ -203,6 +203,7 @@ ev_document_setup_cache (EvDocument *document)
/* Cache some info about the document to avoid
* going to the backends since it requires locks
*/
+ priv->info = _ev_document_get_info (document);
priv->n_pages = _ev_document_get_n_pages (document);
for (i = 0; i < priv->n_pages; i++) {
@@ -267,6 +268,24 @@ ev_document_setup_cache (EvDocument *document)
}
}
+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
@@ -308,22 +327,9 @@ ev_document_load (EvDocument *document,
"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);
- }
- }
+ document->priv->uri = g_strdup (uri);
+ ev_document_initialize_synctex (document, uri);
}
return retval;
@@ -413,6 +419,8 @@ ev_document_load_gfile (EvDocument *document,
return FALSE;
ev_document_setup_cache (document);
+ document->priv->uri = g_file_get_uri (file);
+ ev_document_initialize_synctex (document, document->priv->uri);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]