void nautilus_restore_files_from_trash (GList *files, GtkWindow *parent_window) { NautilusFile *file; GHashTable *original_dirs_hash; GList *unhandled_files, *l; char *message, *file_name; original_dirs_hash = nautilus_trashed_files_get_original_directories (files, &unhandled_files); for (l = unhandled_files; l != NULL; l = l->next) { file = NAUTILUS_FILE (l->data); file_name = nautilus_file_get_display_name (file); message = g_strdup_printf (_("Could not determine original location of “%s” "), file_name); g_free (file_name); eel_show_warning_dialog (message, _("The item cannot be restored from trash"), parent_window); g_free (message); } if (original_dirs_hash != NULL) { restore_files_ensure_parent_directories (original_dirs_hash, parent_window); g_hash_table_unref (original_dirs_hash); } nautilus_file_list_unref (unhandled_files); }
void nautilus_restore_files_from_trash (GList *files, GtkWindow *parent_window) { NautilusFile *file, *original_dir; GHashTable *original_dirs_hash; GList *original_dirs, *unhandled_files; GFile *original_dir_location; GList *locations, *l; char *message, *file_name; original_dirs_hash = nautilus_trashed_files_get_original_directories (files, &unhandled_files); for (l = unhandled_files; l != NULL; l = l->next) { file = NAUTILUS_FILE (l->data); file_name = nautilus_file_get_display_name (file); message = g_strdup_printf (_("Could not determine original location of \"%s\" "), file_name); g_free (file_name); eel_show_warning_dialog (message, _("The item cannot be restored from trash"), parent_window); g_free (message); } if (original_dirs_hash != NULL) { original_dirs = g_hash_table_get_keys (original_dirs_hash); for (l = original_dirs; l != NULL; l = l->next) { original_dir = NAUTILUS_FILE (l->data); original_dir_location = nautilus_file_get_location (original_dir); files = g_hash_table_lookup (original_dirs_hash, original_dir); locations = locations_from_file_list (files); nautilus_file_operations_move (locations, NULL, original_dir_location, parent_window, NULL, NULL); g_list_free_full (locations, g_object_unref); g_object_unref (original_dir_location); } g_list_free (original_dirs); g_hash_table_destroy (original_dirs_hash); } nautilus_file_list_unref (unhandled_files); }