diff src/utilops.c @ 135:15c1925b3bfb

improved external delete command
author nadvornik
date Thu, 16 Aug 2007 20:57:09 +0000
parents 9009856628f7
children 18c2a29e681c
line wrap: on
line diff
--- a/src/utilops.c	Wed Aug 15 21:37:51 2007 +0000
+++ b/src/utilops.c	Thu Aug 16 20:57:09 2007 +0000
@@ -1233,10 +1233,6 @@
 
 	if (!isfile(path)) return FALSE;
 
-	if (editor_command[CMD_DELETE])
-		{
-		return start_editor_from_file(CMD_DELETE, path);
-		}
 
 	if (!safe_delete_enable)
 		{
@@ -1327,6 +1323,26 @@
 {
 	GList *source_list = data;
 
+	if (editor_command[CMD_DELETE])
+		{
+		if (!start_editor_from_path_list(CMD_DELETE, source_list))
+			{
+			file_util_warning_dialog(_("File deletion failed"), _("Unable to delete files by external command\n"), GTK_STOCK_DIALOG_ERROR, NULL);
+			}
+		else
+			{
+			while (source_list)
+				{
+				gchar *path = source_list->data;
+				source_list = g_list_remove(source_list, path);
+				file_maint_removed(path, source_list);
+				g_free(path);
+				}
+			}
+		return;
+		}
+
+
 	while (source_list)
 		{
 		gchar *path = source_list->data;
@@ -1527,7 +1543,20 @@
 {
 	gchar *path = data;
 
-	if (!file_util_unlink(path))
+	if (editor_command[CMD_DELETE])
+		{
+		if (!start_editor_from_file(CMD_DELETE, path))
+			{
+			gchar *text = g_strdup_printf(_("Unable to delete file by external command:\n%s"), path);
+			file_util_warning_dialog(_("File deletion failed"), text, GTK_STOCK_DIALOG_ERROR, NULL);
+			g_free(text);
+			}
+		else
+			{
+			file_maint_removed(path, NULL);
+			}
+		}
+	else if (!file_util_unlink(path))
 		{
 		gchar *text = g_strdup_printf(_("Unable to delete file:\n%s"), path);
 		file_util_warning_dialog(_("File deletion failed"), text, GTK_STOCK_DIALOG_ERROR, NULL);