[latexila/latexila-2-6] Backward search: check that evince is the default document viewer
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila/latexila-2-6] Backward search: check that evince is the default document viewer
- Date: Fri, 7 Jun 2013 11:11:30 +0000 (UTC)
commit 429720a9edb1556cde1c2203d6358db4961b0522
Author: Sébastien Wilmet <swilmet gnome org>
Date: Fri Jun 7 13:03:55 2013 +0200
Backward search: check that evince is the default document viewer
If evince is not the default document viewer for PDF files, the
backward search with synctex is now disabled.
There was a bug with the build tools: when opening a PDF file, the
document was always opened by evince. And if the default document viewer
was not evince, the document was also opened with the other document
viewer. So the PDF file was opened twice.
Thanks to Richard Garavuso for the bug report.
src/utils.vala | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/src/utils.vala b/src/utils.vala
index 85c7ecd..2c6f16c 100644
--- a/src/utils.vala
+++ b/src/utils.vala
@@ -291,13 +291,33 @@ namespace Utils
return;
// Backward search for PDF documents.
- if (get_extension (uri) == ".pdf")
+ if (get_extension (uri) == ".pdf" &&
+ default_document_viewer_is_evince (uri))
{
Synctex synctex = Synctex.get_default ();
synctex.create_evince_window (uri);
}
}
+ private bool default_document_viewer_is_evince (string uri)
+ {
+ File file = File.new_for_uri (uri);
+ AppInfo app;
+
+ try
+ {
+ app = file.query_default_handler ();
+ }
+ catch (Error e)
+ {
+ warning ("Impossible to know if evince is the default document viewer: %s",
+ e.message);
+ return false;
+ }
+
+ return app.get_executable ().contains ("evince");
+ }
+
/*************************************************************************/
// UI stuff
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]