fixed renaming of directories
authorVladimir Nadvornik <nadvornik@suse.cz>
Sat, 26 Jul 2008 19:33:36 +0000 (19:33 +0000)
committerVladimir Nadvornik <nadvornik@suse.cz>
Sat, 26 Jul 2008 19:33:36 +0000 (19:33 +0000)
src/filedata.c
src/utilops.c

index d41a890..9b8d8a6 100644 (file)
@@ -1451,9 +1451,11 @@ static void file_data_sc_update_ci(FileData *fd, const gchar *dest_path)
        
        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 @@ static void file_data_sc_update_ci(FileData *fd, const gchar *dest_path)
                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;
index f2239ac..d71bd51 100644 (file)
@@ -1482,10 +1482,13 @@ void file_util_dialog_run(UtilityData *ud)
                                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;