# HG changeset patch # User nadvornik # Date 1187297829 0 # Node ID 15c1925b3bfb0f3f2fe75043a482e796597096e0 # Parent 9009856628f73f5ff65960b8362a875678b780e5 improved external delete command diff -r 9009856628f7 -r 15c1925b3bfb src/editors.c --- a/src/editors.c Wed Aug 15 21:37:51 2007 +0000 +++ b/src/editors.c Thu Aug 16 20:57:09 2007 +0000 @@ -396,7 +396,7 @@ } else { - ret = system(result->str); + ret = !system(result->str); } if (path_change) chdir(current_path); @@ -450,7 +450,7 @@ return FALSE; } -static void editor_command_start(const gchar *template, const gchar *text, GList *list) +static gint editor_command_start(const gchar *template, const gchar *text, GList *list) { EditorVerboseData *vd; @@ -458,7 +458,7 @@ vd->list = path_list_copy(list); vd->total = g_list_length(list); - editor_command_next(vd); + return editor_command_next(vd); } static gint editor_line_break(const gchar *template, gchar **front, const gchar **end) @@ -544,7 +544,7 @@ while (work) { gchar *path = work->data; - editor_command_one(template, path, NULL); + ret = editor_command_one(template, path, NULL); work = work->next; } } @@ -588,14 +588,11 @@ vd = editor_verbose_window(template, text); editor_verbose_window_progress(vd, _("running...")); - editor_verbose_start(vd, result->str); + ret = editor_verbose_start(vd, result->str); } else { - int status = system(result->str); - /* FIXME: consistent return values */ - if (!WIFEXITED(status) || WEXITSTATUS(status)) - ret = FALSE; + ret = !system(result->str); } g_free(front); diff -r 9009856628f7 -r 15c1925b3bfb src/editors.h --- a/src/editors.h Wed Aug 15 21:37:51 2007 +0000 +++ b/src/editors.h Thu Aug 16 20:57:09 2007 +0000 @@ -17,7 +17,6 @@ void editor_reset_defaults(void); 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); diff -r 9009856628f7 -r 15c1925b3bfb src/utilops.c --- 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);