diff src/utilops.c @ 136:18c2a29e681c

more external commands
author nadvornik
date Mon, 20 Aug 2007 20:11:32 +0000
parents 15c1925b3bfb
children 71e1ebee420e
line wrap: on
line diff
--- a/src/utilops.c	Thu Aug 16 20:57:09 2007 +0000
+++ b/src/utilops.c	Mon Aug 20 20:11:32 2007 +0000
@@ -333,6 +333,28 @@
  *--------------------------------------------------------------------------
  */
 
+static gint copy_file_ext(const gchar *s, const gchar *t)
+{
+	if (editor_command[CMD_COPY])
+		return start_editor_from_pair(CMD_COPY, s, t);
+	return copy_file(s, t);
+}
+
+static gint move_file_ext(const gchar *s, const gchar *t)
+{
+	if (editor_command[CMD_MOVE])
+		return start_editor_from_pair(CMD_MOVE, s, t);
+	return move_file(s, t);
+}
+
+static gint rename_file_ext(const gchar *s, const gchar *t)
+{
+	if (editor_command[CMD_RENAME])
+		return start_editor_from_pair(CMD_RENAME, s, t);
+	return rename_file(s, t);
+}
+
+
 /*
  * Multi file move
  */
@@ -637,7 +659,7 @@
 				{
 				if (fdm->copy)
 					{
-					if (copy_file(fdm->source, fdm->dest))
+					if (copy_file_ext(fdm->source, fdm->dest))
 						{
 						success = TRUE;
 						file_maint_copied(fdm->source, fdm->dest);
@@ -645,7 +667,7 @@
 					}
 				else
 					{
-					if (move_file(fdm->source, fdm->dest))
+					if (move_file_ext(fdm->source, fdm->dest))
 						{
 						success = TRUE;
 						file_maint_moved(fdm->source, fdm->dest, fdm->source_list);
@@ -870,7 +892,7 @@
 		gint success = FALSE;
 		if (fds->copy)
 			{
-			if (copy_file(fds->source, fds->dest))
+			if (copy_file_ext(fds->source, fds->dest))
 				{
 				success = TRUE;
 				file_maint_copied(fds->source, fds->dest);
@@ -878,7 +900,7 @@
 			}
 		else
 			{
-			if (move_file(fds->source, fds->dest))
+			if (move_file_ext(fds->source, fds->dest))
 				{
 				success = TRUE;
 				file_maint_moved(fds->source, fds->dest, NULL);
@@ -1768,7 +1790,7 @@
 		}
 	else
 		{
-		if (!rename_file(fd->source_path, fd->dest_path))
+		if (!rename_file_ext(fd->source_path, fd->dest_path))
 			{
 			gchar *text = g_strdup_printf(_("Unable to rename file:\n%s\n to:\n%s"),
 						      filename_from_path(fd->source_path),
@@ -1989,7 +2011,7 @@
 			dest = g_strdup_printf("%s/%s%0*d%s", base, front, padding, n, end);
 			}
 
-		if (!rename_file(path, dest))
+		if (!rename_file_ext(path, dest))
 			{
 			success = FALSE;
 			}
@@ -2489,7 +2511,7 @@
 		}
 	else
 		{
-		if (!rename_file(fds->source, fds->dest))
+		if (!rename_file_ext(fds->source, fds->dest))
 			{
 			gchar *text = g_strdup_printf(_("Unable to rename file:\n%s\nto:\n%s"), filename_from_path(fds->source), filename_from_path(fds->dest));
 			file_util_warning_dialog(_("Error renaming file"), text, GTK_STOCK_DIALOG_ERROR, NULL);
@@ -2704,7 +2726,7 @@
 		return FALSE;
 		}
 
-	if (!rename_file(old_path, new_path))
+	if (!rename_file_ext(old_path, new_path))
 		{
 		gchar *text = g_strdup_printf(_("Failed to rename %s to %s."), old_name, new_name);
 		file_util_warning_dialog(_("Rename failed"), text, GTK_STOCK_DIALOG_ERROR, parent);