Check for existing editor command using is_valid_editor_command().
authorLaurent Monin <geeqie@norz.org>
Fri, 30 May 2008 07:20:25 +0000 (07:20 +0000)
committerLaurent Monin <geeqie@norz.org>
Fri, 30 May 2008 07:20:25 +0000 (07:20 +0000)
src/editors.c
src/editors.h
src/trash.c
src/utilops.c

index 36c9428..cac2625 100644 (file)
@@ -808,7 +808,7 @@ static gint editor_command_start(const gchar *template, const gchar *text, GList
        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
index 3079f12..c35e00d 100644 (file)
@@ -74,4 +74,6 @@ const gchar *editor_get_error_str(gint flags);
 
 const gchar *editor_get_name(gint n);
 
+gboolean is_valid_editor_command(gint n);
+
 #endif
index f9a3e62..deeb6d8 100644 (file)
@@ -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 *file_util_safe_delete_status(void)
 {
        gchar *buf;
 
-       if (options->editor[CMD_DELETE].command)
+       if (is_valid_editor_command(CMD_DELETE))
                {
                buf = g_strdup(_("Deletion by external command"));
                }
index 01a0e06..d8e8aa5 100644 (file)
@@ -667,7 +667,7 @@ void file_util_perform_ci(UtilityData *ud)
                        break;
                }
 
-       if (ud->external_command != -1 && options->editor[ud->external_command].command)
+       if (is_valid_editor_command(ud->external_command))
                {
                gint flags;