summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorericek111 <[email protected]>2020-11-25 10:50:46 +0100
committerraveit65 <[email protected]>2021-03-24 10:22:27 +0100
commit4cb57415dacb04bcf3e909d9a8cf5e71ddebea06 (patch)
tree3266805c008d3646801115018c34632f268d2e2a
parenta0df7f63792f0970100efff856ea0076e3faf15e (diff)
downloadcaja-4cb57415dacb04bcf3e909d9a8cf5e71ddebea06.tar.bz2
caja-4cb57415dacb04bcf3e909d9a8cf5e71ddebea06.tar.xz
file-operations: don't attempt to move into the source dir
-rw-r--r--libcaja-private/caja-file-operations.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/libcaja-private/caja-file-operations.c b/libcaja-private/caja-file-operations.c
index fc400a3a..1a044217 100644
--- a/libcaja-private/caja-file-operations.c
+++ b/libcaja-private/caja-file-operations.c
@@ -5884,6 +5884,7 @@ caja_file_operations_copy_move (const GList *item_uris,
{
GList *locations;
GList *p;
+ GFile *src_dir;
GFile *dest;
GtkWindow *parent_window;
gboolean target_is_mapping;
@@ -5920,10 +5921,9 @@ caja_file_operations_copy_move (const GList *item_uris,
parent_window = (GtkWindow *)gtk_widget_get_ancestor (parent_view, GTK_TYPE_WINDOW);
}
- if (copy_action == GDK_ACTION_COPY) {
- GFile *src_dir;
+ src_dir = g_file_get_parent (locations->data);
- src_dir = g_file_get_parent (locations->data);
+ if (copy_action == GDK_ACTION_COPY) {
if (target_dir == NULL ||
(src_dir != NULL &&
g_file_equal (src_dir, dest))) {
@@ -5938,10 +5938,6 @@ caja_file_operations_copy_move (const GList *item_uris,
parent_window,
done_callback, done_callback_data);
}
- if (src_dir) {
- g_object_unref (src_dir);
- }
-
} else if (copy_action == GDK_ACTION_MOVE) {
if (g_file_has_uri_scheme (dest, "trash")) {
MoveTrashCBData *cb_data;
@@ -5953,7 +5949,7 @@ caja_file_operations_copy_move (const GList *item_uris,
parent_window,
(CajaDeleteCallback) callback_for_move_to_trash,
cb_data);
- } else {
+ } else if (src_dir == NULL || !g_file_equal (src_dir, dest)) {
caja_file_operations_move (locations,
relative_item_points,
dest,
@@ -5972,6 +5968,10 @@ caja_file_operations_copy_move (const GList *item_uris,
if (dest) {
g_object_unref (dest);
}
+
+ if (src_dir) {
+ g_object_unref (src_dir);
+ }
}
static gboolean