diff --git a/src/nautilus-batch-rename-dialog.c b/src/nautilus-batch-rename-dialog.c index b3bc6c9cf..00678ca91 100644 --- a/src/nautilus-batch-rename-dialog.c +++ b/src/nautilus-batch-rename-dialog.c @@ -422,9 +422,6 @@ static void begin_batch_rename (NautilusBatchRenameDialog *dialog, GList *new_names) { - batch_rename_sort_lists_for_rename (&dialog->selection, &new_names, NULL, NULL, NULL, FALSE); - - /* do the actual rename here */ nautilus_file_batch_rename (dialog->selection, new_names, NULL, NULL); gtk_widget_set_cursor (GTK_WIDGET (dialog->window), NULL); diff --git a/src/nautilus-batch-rename-utilities.c b/src/nautilus-batch-rename-utilities.c index a8c312bb9..04fe4be0d 100644 --- a/src/nautilus-batch-rename-utilities.c +++ b/src/nautilus-batch-rename-utilities.c @@ -142,124 +142,6 @@ batch_rename_replace (gchar *string, return new_string; } -void -batch_rename_sort_lists_for_rename (GList **selection, - GList **new_names, - GList **old_names, - GList **new_files, - GList **old_files, - gboolean is_undo_redo) -{ - GList *new_names_list; - GList *new_names_list2; - GList *files; - GList *files2; - GList *old_names_list = NULL; - GList *new_files_list = NULL; - GList *old_files_list = NULL; - GList *old_names_list2 = NULL; - GList *new_files_list2 = NULL; - GList *old_files_list2 = NULL; - GString *new_file_name; - GString *new_name; - GString *old_name; - GFile *new_file; - GFile *old_file; - NautilusFile *file; - gboolean order_changed = TRUE; - - /* in the following case: - * file1 -> file2 - * file2 -> file3 - * file2 must be renamed first, so because of that, the list has to be reordered - */ - while (order_changed) - { - order_changed = FALSE; - - if (is_undo_redo) - { - old_names_list = *old_names; - new_files_list = *new_files; - old_files_list = *old_files; - } - - for (new_names_list = *new_names, files = *selection; - new_names_list != NULL && files != NULL; - new_names_list = new_names_list->next, files = files->next) - { - g_autoptr (NautilusFile) parent = NULL; - - new_file_name = new_names_list->data; - parent = nautilus_file_get_parent (NAUTILUS_FILE (files->data)); - - if (is_undo_redo) - { - old_names_list2 = old_names_list; - new_files_list2 = new_files_list; - old_files_list2 = old_files_list; - } - - for (files2 = files, new_names_list2 = new_names_list; - files2 != NULL && new_names_list2 != NULL; - files2 = files2->next, new_names_list2 = new_names_list2->next) - { - const char *file_name; - g_autoptr (NautilusFile) parent2 = NULL; - - file_name = nautilus_file_get_name (NAUTILUS_FILE (files2->data)); - new_name = new_names_list2->data; - - parent2 = nautilus_file_get_parent (NAUTILUS_FILE (files2->data)); - - if (files2 != files && g_strcmp0 (file_name, new_file_name->str) == 0 && - parent == parent2) - { - file = NAUTILUS_FILE (files2->data); - - *selection = g_list_remove_link (*selection, files2); - *new_names = g_list_remove_link (*new_names, new_names_list2); - - *selection = g_list_prepend (*selection, file); - *new_names = g_list_prepend (*new_names, new_name); - - if (is_undo_redo) - { - old_name = old_names_list2->data; - new_file = new_files_list2->data; - old_file = old_files_list2->data; - - *old_names = g_list_remove_link (*old_names, old_names_list2); - *new_files = g_list_remove_link (*new_files, new_files_list2); - *old_files = g_list_remove_link (*old_files, old_files_list2); - - *old_names = g_list_prepend (*old_names, old_name); - *new_files = g_list_prepend (*new_files, new_file); - *old_files = g_list_prepend (*old_files, old_file); - } - - order_changed = TRUE; - break; - } - - if (is_undo_redo) - { - old_names_list2 = old_names_list2->next; - new_files_list2 = new_files_list2->next; - old_files_list2 = old_files_list2->next; - } - } - - if (is_undo_redo) - { - old_names_list = old_names_list->next; - new_files_list = new_files_list->next; - old_files_list = old_files_list->next; - } - } - } -} - /* This function changes the background color of the replaced part of the name */ GString * batch_rename_replace_label_text (const char *label, diff --git a/src/nautilus-batch-rename-utilities.h b/src/nautilus-batch-rename-utilities.h index 39a7b12c0..bf365945c 100644 --- a/src/nautilus-batch-rename-utilities.h +++ b/src/nautilus-batch-rename-utilities.h @@ -61,10 +61,3 @@ GString* batch_rename_replace_label_text (const char *label, const gchar *substr); gchar* batch_rename_get_tag_text_representation (TagConstants tag_constants); - -void batch_rename_sort_lists_for_rename (GList **selection, - GList **new_names, - GList **old_names, - GList **new_files, - GList **old_files, - gboolean is_undo_redo); diff --git a/src/nautilus-file-undo-operations.c b/src/nautilus-file-undo-operations.c index 0a84b9dad..b18bedb1b 100644 --- a/src/nautilus-file-undo-operations.c +++ b/src/nautilus-file-undo-operations.c @@ -31,7 +31,6 @@ #include "nautilus-file.h" #include "nautilus-file-undo-manager.h" #include "nautilus-batch-rename-dialog.h" -#include "nautilus-batch-rename-utilities.h" #include "nautilus-scheme.h" #include "nautilus-tag-manager.h" @@ -1200,13 +1199,6 @@ batch_rename_redo_func (NautilusFileUndoInfo *info, files = g_list_reverse (files); - batch_rename_sort_lists_for_rename (&files, - &self->new_display_names, - &self->old_display_names, - &self->new_files, - &self->old_files, - TRUE); - nautilus_file_batch_rename (files, self->new_display_names, file_undo_info_operation_callback, self); } @@ -1233,13 +1225,6 @@ batch_rename_undo_func (NautilusFileUndoInfo *info, files = g_list_reverse (files); - batch_rename_sort_lists_for_rename (&files, - &self->old_display_names, - &self->new_display_names, - &self->old_files, - &self->new_files, - TRUE); - nautilus_file_batch_rename (files, self->old_display_names, file_undo_info_operation_callback, self); }