Lines 3224-3229
Link Here
|
3224 |
} |
3224 |
} |
3225 |
} |
3225 |
} |
3226 |
|
3226 |
|
|
|
3227 |
static gboolean |
3228 |
g_file_struct_contains (GFile *child, GFile *root) |
3229 |
{ |
3230 |
GFile *f; |
3231 |
|
3232 |
f = g_file_dup (child); |
3233 |
while (f) { |
3234 |
if (g_file_equal (f, root)) { |
3235 |
g_object_unref (f); |
3236 |
return TRUE; |
3237 |
} |
3238 |
f = g_file_get_parent (f); |
3239 |
} |
3240 |
|
3241 |
if (f) g_object_unref (f); |
3242 |
return FALSE; |
3243 |
} |
3244 |
|
3227 |
/* Debuting files is non-NULL only for toplevel items */ |
3245 |
/* Debuting files is non-NULL only for toplevel items */ |
3228 |
static void |
3246 |
static void |
3229 |
copy_move_file (CopyMoveJob *copy_job, |
3247 |
copy_move_file (CopyMoveJob *copy_job, |
Lines 3264-3269
Link Here
|
3264 |
dest = get_target_file (src, dest_dir, same_fs); |
3282 |
dest = get_target_file (src, dest_dir, same_fs); |
3265 |
} |
3283 |
} |
3266 |
|
3284 |
|
|
|
3285 |
|
3286 |
/* Don't allow recursive move/copy into itself. |
3287 |
* (We would get a file system error if we proceeded but it is nicer to |
3288 |
* detect and report it at this level) */ |
3289 |
if (g_file_struct_contains (dest_dir, src)) { |
3290 |
if (job->skip_all_error) { |
3291 |
g_error_free (error); |
3292 |
goto out; |
3293 |
} |
3294 |
|
3295 |
/* the run_warning() frees all strings passed in automatically */ |
3296 |
primary = copy_job->is_move ? g_strdup (_("You cannot move a folder into itself.")) |
3297 |
: g_strdup (_("You cannot copy a folder into itself.")); |
3298 |
secondary = g_strdup (_("The destination folder is inside the source folder.")); |
3299 |
|
3300 |
response = run_warning (job, |
3301 |
primary, |
3302 |
secondary, |
3303 |
NULL, |
3304 |
GTK_STOCK_CANCEL, SKIP_ALL, SKIP, |
3305 |
NULL); |
3306 |
|
3307 |
if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) { |
3308 |
abort_job (job); |
3309 |
} else if (response == 1) { /* skip all */ |
3310 |
job->skip_all_error = TRUE; |
3311 |
} else if (response == 2) { /* skip */ |
3312 |
/* do nothing */ |
3313 |
} else { |
3314 |
g_assert_not_reached (); |
3315 |
} |
3316 |
|
3317 |
goto out; |
3318 |
} |
3319 |
|
3267 |
retry: |
3320 |
retry: |
3268 |
|
3321 |
|
3269 |
error = NULL; |
3322 |
error = NULL; |
Lines 3791-3796
Link Here
|
3791 |
|
3844 |
|
3792 |
dest = get_target_file (src, dest_dir, same_fs); |
3845 |
dest = get_target_file (src, dest_dir, same_fs); |
3793 |
|
3846 |
|
|
|
3847 |
|
3848 |
/* Don't allow recursive move/copy into itself. |
3849 |
* (We would get a file system error if we proceeded but it is nicer to |
3850 |
* detect and report it at this level) */ |
3851 |
if (g_file_struct_contains (dest_dir, src)) { |
3852 |
if (job->skip_all_error) { |
3853 |
g_error_free (error); |
3854 |
goto out; |
3855 |
} |
3856 |
|
3857 |
/* the run_warning() frees all strings passed in automatically */ |
3858 |
primary = move_job->is_move ? g_strdup (_("You cannot move a folder into itself.")) |
3859 |
: g_strdup (_("You cannot copy a folder into itself.")); |
3860 |
secondary = g_strdup (_("The destination folder is inside the source folder.")); |
3861 |
|
3862 |
response = run_warning (job, |
3863 |
primary, |
3864 |
secondary, |
3865 |
NULL, |
3866 |
GTK_STOCK_CANCEL, SKIP_ALL, SKIP, |
3867 |
NULL); |
3868 |
|
3869 |
if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) { |
3870 |
abort_job (job); |
3871 |
} else if (response == 1) { /* skip all */ |
3872 |
job->skip_all_error = TRUE; |
3873 |
} else if (response == 2) { /* skip */ |
3874 |
/* do nothing */ |
3875 |
} else { |
3876 |
g_assert_not_reached (); |
3877 |
} |
3878 |
|
3879 |
goto out; |
3880 |
} |
3881 |
|
3794 |
retry: |
3882 |
retry: |
3795 |
|
3883 |
|
3796 |
flags = G_FILE_COPY_NOFOLLOW_SYMLINKS | G_FILE_COPY_NO_FALLBACK_FOR_MOVE; |
3884 |
flags = G_FILE_COPY_NOFOLLOW_SYMLINKS | G_FILE_COPY_NO_FALLBACK_FOR_MOVE; |