};
-static gchar *editor_slot_defaults[] = {
+static gchar *editor_slot_defaults[GQVIEW_EDITOR_SLOTS * 2] = {
N_("The Gimp"), "gimp-remote -n %f",
N_("XV"), "xv %f",
N_("Xpaint"), "xpaint %f",
NULL, NULL,
N_("Rotate jpeg clockwise"), "%vif jpegtran -rotate 90 -copy all -outfile %p_tmp %p; then mv %p_tmp %p;else rm %p_tmp;fi",
N_("Rotate jpeg counterclockwise"), "%vif jpegtran -rotate 270 -copy all -outfile %p_tmp %p; then mv %p_tmp %p;else rm %p_tmp;fi",
- NULL, NULL
+ /* special slots */
+ "External Copy command", NULL,
+ "External Move command", NULL,
+ "External Rename command", NULL,
+ "External Delete command", NULL,
+ "External New Folder command", NULL
};
-
static void editor_verbose_window_progress(EditorVerboseData *vd, const gchar *text);
static gint editor_command_next(EditorVerboseData *vd);
*
* [1] Note: %v,%V may also be preceded by "%w".
*/
-static void editor_command_run(const gchar *template, const gchar *text, GList *list)
+static gint editor_command_run(const gchar *template, const gchar *text, GList *list)
{
gint verbose = FALSE;
gint for_each = FALSE;
+ gint ret = TRUE;
if (!template || template[0] == '\0') return;
}
else
{
- system(result->str);
+ int status = system(result->str);
+ /* FIXME: consistent return values */
+ if (!WIFEXITED(status) || WEXITSTATUS(status))
+ ret = FALSE;
}
g_free(front);
g_string_free(result, TRUE);
}
+ return ret;
}
-void start_editor_from_path_list(gint n, GList *list)
+gint start_editor_from_path_list(gint n, GList *list)
{
gchar *command;
+ gint ret;
if (n < 0 || n >= GQVIEW_EDITOR_SLOTS || !list ||
!editor_command[n] ||
- strlen(editor_command[n]) == 0) return;
+ strlen(editor_command[n]) == 0) return FALSE;
command = g_locale_from_utf8(editor_command[n], -1, NULL, NULL, NULL);
- editor_command_run(command, editor_name[n], list);
+ ret = editor_command_run(command, editor_name[n], list);
g_free(command);
+ return ret;
}
-void start_editor_from_file(gint n, const gchar *path)
+gint start_editor_from_file(gint n, const gchar *path)
{
GList *list;
+ gint ret;
- if (!path) return;
+ if (!path) return FALSE;
list = g_list_append(NULL, (gchar *)path);
- start_editor_from_path_list(n, list);
+ ret = start_editor_from_path_list(n, list);
g_list_free(list);
+ return ret;
}
gint editor_window_flag_set(gint n)
void editor_reset_defaults(void);
-void start_editor_from_file(gint n, const gchar *path);
-void start_editor_from_path_list(gint n, GList *list);
+gint start_editor_from_file(gint n, const gchar *path);
+gint start_editor_from_path_list(gint n, GList *list);
gint editor_window_flag_set(gint n);
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk-pixbuf/gdk-pixbuf-loader.h>
-#include "typedefs.h"
/*
*----------------------------------------------------------------------------
#define MOUSEWHEEL_SCROLL_SIZE 20
-#define GQVIEW_EDITOR_SLOTS 10
+#define GQVIEW_EDITOR_GENERIC_SLOTS 10
#define COLOR_PROFILE_INPUTS 4
+#include "typedefs.h"
+
/*
*----------------------------------------------------------------------------
* globals
for(i = 0; i < GQVIEW_EDITOR_SLOTS; i++)
{
- g_free(editor_name[i]);
- editor_name[i] = NULL;
- buf = gtk_entry_get_text(GTK_ENTRY(editor_name_entry[i]));
- if (buf && strlen(buf) > 0) editor_name[i] = g_strdup(buf);
+ if (i < GQVIEW_EDITOR_GENERIC_SLOTS)
+ {
+ g_free(editor_name[i]);
+ editor_name[i] = NULL;
+ buf = gtk_entry_get_text(GTK_ENTRY(editor_name_entry[i]));
+ if (buf && strlen(buf) > 0) editor_name[i] = g_strdup(buf);
+ }
g_free(editor_command[i]);
editor_command[i] = NULL;
for (i = 0; i < GQVIEW_EDITOR_SLOTS; i++)
{
- gtk_entry_set_text(GTK_ENTRY(editor_name_entry[i]),
+ if (i < GQVIEW_EDITOR_GENERIC_SLOTS)
+ gtk_entry_set_text(GTK_ENTRY(editor_name_entry[i]),
(editor_name[i]) ? editor_name[i] : "");
gtk_entry_set_text(GTK_ENTRY(editor_command_entry[i]),
(editor_command[i]) ? editor_command[i] : "");
{
gchar *buf;
- buf = g_strdup_printf("%d", i+1);
- pref_table_label(table, 0, i+1, buf, 1.0);
- g_free(buf);
- editor_name_entry[i] = gtk_entry_new();
- gtk_entry_set_max_length(GTK_ENTRY(editor_name_entry[i]), EDITOR_NAME_MAX_LENGTH);
- gtk_widget_set_size_request(editor_name_entry[i],80,-1);
- if (editor_name[i]) gtk_entry_set_text(GTK_ENTRY(editor_name_entry[i]),editor_name[i]);
+ if (i < GQVIEW_EDITOR_GENERIC_SLOTS)
+ {
+ buf = g_strdup_printf("%d", i+1);
+ pref_table_label(table, 0, i+1, buf, 1.0);
+ g_free(buf);
+ editor_name_entry[i] = gtk_entry_new();
+ gtk_entry_set_max_length(GTK_ENTRY(editor_name_entry[i]), EDITOR_NAME_MAX_LENGTH);
+ gtk_widget_set_size_request(editor_name_entry[i],80,-1);
+ if (editor_name[i]) gtk_entry_set_text(GTK_ENTRY(editor_name_entry[i]),editor_name[i]);
+ }
+ else
+ {
+ editor_name_entry[i] = gtk_label_new(editor_name[i]);
+ }
+
gtk_table_attach(GTK_TABLE (table),editor_name_entry[i],1,2,i+1,i+2,
GTK_FILL | GTK_EXPAND, 0, 0, 0);
gtk_widget_show(editor_name_entry[i]);
#ifndef TYPEDEFS_H
#define TYPEDEFS_H
+typedef enum {
+ CMD_COPY = GQVIEW_EDITOR_GENERIC_SLOTS,
+ CMD_MOVE,
+ CMD_RENAME,
+ CMD_DELETE,
+ CMD_FOLDER,
+ GQVIEW_EDITOR_SLOTS
+} SpecialEditor;
typedef enum {
SORT_NONE,
if (!isfile(path)) return FALSE;
+ if (editor_command[CMD_DELETE])
+ {
+ return start_editor_from_file(CMD_DELETE, path);
+ }
+
if (!safe_delete_enable)
{
return unlink_file(path);