[gnome-documents] pdf-loader: check for unoconv in path before spawning it



commit 941c5c3d665bc62da5a0b0b3925d5d2af3a26f53
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Jan 16 13:28:22 2012 -0500

    pdf-loader: check for unoconv in path before spawning it
    
    Use a better error message in that case.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=660179

 src/lib/gd-pdf-loader.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/src/lib/gd-pdf-loader.c b/src/lib/gd-pdf-loader.c
index 651ded7..e157706 100644
--- a/src/lib/gd-pdf-loader.c
+++ b/src/lib/gd-pdf-loader.c
@@ -473,13 +473,25 @@ unoconv_child_watch_cb (GPid pid,
 static void
 pdf_load_job_openoffice_refresh_cache (PdfLoadJob *job)
 {
-  gchar *doc_path, *cmd, *quoted_path;
+  gchar *doc_path, *cmd, *quoted_path, *unoconv_path;
   GFile *file;
   gint argc;
   GPid pid;
   gchar **argv = NULL;
   GError *error = NULL;
 
+  unoconv_path = g_find_program_in_path ("unoconv");
+  if (unoconv_path == NULL)
+    {
+      error = g_error_new_literal (G_IO_ERROR,
+                                   G_IO_ERROR_NOT_FOUND,
+                                   _("Cannot find \"unoconv\", please check your LibreOffice installation"));
+      pdf_load_job_complete_error (job, error);
+      return;
+    }
+
+  g_free (unoconv_path);
+
   /* build the temporary PDF file path */
   file = g_file_new_for_uri (job->uri);
   doc_path = g_file_get_path (file);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]