changeset 934:6aa60ae6f274

fixed renaming of directories
author nadvornik
date Sat, 26 Jul 2008 19:33:36 +0000
parents 8c5ba3e94e54
children ae641f36159d
files src/filedata.c src/utilops.c
diffstat 2 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/filedata.c	Sat Jul 26 19:01:20 2008 +0000
+++ b/src/filedata.c	Sat Jul 26 19:33:36 2008 +0000
@@ -1451,9 +1451,11 @@
 	
 	if (fd->parent) fd = fd->parent;
 	
-	if (!dest_path) dest_path = fd->path;
-	
-	if (!strchr(dest_path, G_DIR_SEPARATOR)) /* we got only filename, not a full path */
+	if (!dest_path) 
+		{
+		dest_path = fd->path;
+		}
+	else if (!strchr(dest_path, G_DIR_SEPARATOR)) /* we got only filename, not a full path */
 		{
 		gchar *dir = remove_level_from_path(fd->path);
 		
@@ -1461,8 +1463,7 @@
 		g_free(dir);
 		dest_path = dest_path_full;
 		}
-	
-	if (isdir(dest_path))
+	else if (fd->change->type != FILEDATA_CHANGE_RENAME && isdir(dest_path)) /* rename should not move files between directories */
 		{
 		dest_path_full = g_build_filename(dest_path, fd->name, NULL);
 		dest_path = dest_path_full;
--- a/src/utilops.c	Sat Jul 26 19:01:20 2008 +0000
+++ b/src/utilops.c	Sat Jul 26 19:33:36 2008 +0000
@@ -1482,10 +1482,13 @@
 				case UTILITY_TYPE_COPY:
 				case UTILITY_TYPE_MOVE:
 				case UTILITY_TYPE_FILTER:
-				case UTILITY_TYPE_RENAME_FOLDER:
 				case UTILITY_TYPE_CREATE_FOLDER:
 					file_util_dialog_init_dest_folder(ud);
 					break;
+				case UTILITY_TYPE_RENAME_FOLDER:
+					ud->phase = UTILITY_PHASE_CANCEL; /* FIXME - not handled for now */
+					file_util_dialog_run(ud);
+					return;
 				}
 			ud->phase = UTILITY_PHASE_ENTERING;
 			break;