+2006-02-13 Nickolay V. Shmyrev <nshmyrev@yandex.ru>
+
+ * configure.ac:
+ * ps/gsdefaults.c: (gtk_gs_defaults_get_paper_sizes):
+ * ps/gsdefaults.h:
+ * ps/ps-document.c: (start_interpreter), (ps_document_load):
+
+ Runtime check for gs interpreter. Fix for the bug #320868.
+ Thanks to Antoine Dopffer antoine.dopffer@free.fr
+
2006-02-12 Carlos Garcia Campos <carlosgc@gnome.org>
* shell/ev-application.c:
AM_CONDITIONAL(ENABLE_PS, test x$enable_ps = xyes)
if test x$enable_ps = xyes; then
-AC_ARG_WITH(gs,
- [AC_HELP_STRING([--with-gs=dir], [Directory Where GhostScript package is installed.])])
-
-if test "x$with_gs" = "x"; then
- AC_PATH_PROG(GS_PROG, gs)
- if test -z "$GS_PROG"; then
- AC_MSG_ERROR(Unable to find GhostScript in the PATH. Provide the full path for GhostScript(--with-gs=PATH). You need to have Ghostscript installed in order to run evince)
- fi
-else
- GS_PROG=$with_gs
-fi
-
-AC_DEFINE_UNQUOTED(GS_PATH, "$GS_PROG", [Path to the 'gs' executable.])
dnl check for GS version
AC_MSG_CHECKING(for Ghostscript version...)
#define NUM_GS_ARGS (NUM_ARGS - 20)
#define NUM_ALPHA_ARGS 10
- char *argv[NUM_ARGS], *dir, *gv_env;
+ char *argv[NUM_ARGS], *dir, *gv_env, *gs_path;
char **gs_args, **alpha_args = NULL;
int argc = 0, i;
stop_interpreter(gs);
/* set up the args... */
- gs_args = g_strsplit (gtk_gs_defaults_get_interpreter_cmd (), " ", NUM_GS_ARGS);
+ gs_path = g_find_program_in_path ("gs");
+ gs_args = g_strsplit (gs_path, " ", NUM_GS_ARGS);
+ g_free (gs_path);
for(i = 0; i < NUM_GS_ARGS && gs_args[i]; i++, argc++) {
argv[argc] = gs_args[i];
}
const char *uri,
GError **error)
{
- gboolean result;
char *filename;
+ char *gs_path;
+ gboolean result;
filename = g_filename_from_uri (uri, NULL, error);
if (!filename)
return FALSE;
- result = document_load (PS_DOCUMENT (document), filename);
- if (!result) {
- gchar *filename_dsp;
-
- filename_dsp = g_filename_display_name (filename);
-
- g_set_error (error, G_FILE_ERROR,
- G_FILE_ERROR_FAILED,
- _("Failed to load document '%s'"),
- filename_dsp);
-
- g_free (filename_dsp);
+ gs_path = g_find_program_in_path ("gs");
+ if (!gs_path) {
+ gchar *filename_dsp;
+ filename_dsp = g_filename_display_name (filename);
+ g_set_error(error,
+ G_FILE_ERROR,
+ G_FILE_ERROR_NOENT,
+ _("Failed to load document '%s'. Ghostscript interpreter was not found in path"),
+ filename);
+ g_free (filename_dsp);
+ result = FALSE;
+ } else {
+ result = document_load (PS_DOCUMENT (document), filename);
+ if (!result) {
+ gchar *filename_dsp;
+ filename_dsp = g_filename_display_name (filename);
+
+ g_set_error (error, G_FILE_ERROR,
+ G_FILE_ERROR_FAILED,
+ _("Failed to load document '%s'"),
+ filename_dsp);
+ g_free (filename_dsp);
+ }
+ g_free (gs_path);
}
-
g_free (filename);
return result;