changeset 766:7148e125bf23

Check for existing editor command using is_valid_editor_command().
author zas_
date Fri, 30 May 2008 07:20:25 +0000
parents 339db85846da
children e73d30e0c896
files src/editors.c src/editors.h src/trash.c src/utilops.c
diffstat 4 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/editors.c	Thu May 29 07:58:34 2008 +0000
+++ b/src/editors.c	Fri May 30 07:20:25 2008 +0000
@@ -808,7 +808,7 @@
 	return flags & EDITOR_ERROR_MASK;
 }
 
-static gint is_valid_editor_command(gint n)
+gboolean is_valid_editor_command(gint n)
 {
 	return (n >= 0 && n < GQ_EDITOR_SLOTS
 		&& options->editor[n].command
--- a/src/editors.h	Thu May 29 07:58:34 2008 +0000
+++ b/src/editors.h	Fri May 30 07:20:25 2008 +0000
@@ -74,4 +74,6 @@
 
 const gchar *editor_get_name(gint n);
 
+gboolean is_valid_editor_command(gint n);
+
 #endif
--- a/src/trash.c	Thu May 29 07:58:34 2008 +0000
+++ b/src/trash.c	Fri May 30 07:20:25 2008 +0000
@@ -15,7 +15,7 @@
 #include "trash.h"
 #include "utilops.h"
 
-
+#include "editors.h"
 #include "filedata.h"
 #include "ui_fileops.h"
 #include "ui_misc.h"
@@ -181,7 +181,7 @@
 {
 	gchar *buf;
 
-	if (options->editor[CMD_DELETE].command)
+	if (is_valid_editor_command(CMD_DELETE))
 		{
 		buf = g_strdup(_("Deletion by external command"));
 		}
--- a/src/utilops.c	Thu May 29 07:58:34 2008 +0000
+++ b/src/utilops.c	Fri May 30 07:20:25 2008 +0000
@@ -667,7 +667,7 @@
 			break;
 		}
 
-	if (ud->external_command != -1 && options->editor[ud->external_command].command)
+	if (is_valid_editor_command(ud->external_command))
 		{
 		gint flags;