summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorericek111 <[email protected]>2020-11-25 10:50:46 +0100
committerraveit65 <[email protected]>2022-07-21 19:33:49 +0200
commit6dac48200e34cdf3354260dd91f8692ab7fa82c6 (patch)
treebb3a9a5332903e624fb707e33e0b5dc4e7a56f36
parent3922281831b069c26f675520f135fb3ecc0e5429 (diff)
downloadcaja-6dac48200e34cdf3354260dd91f8692ab7fa82c6.tar.bz2
caja-6dac48200e34cdf3354260dd91f8692ab7fa82c6.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 c3732b09..dbf5734c 100644
--- a/libcaja-private/caja-file-operations.c
+++ b/libcaja-private/caja-file-operations.c
@@ -5882,6 +5882,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;
@@ -5918,10 +5919,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))) {
@@ -5936,10 +5936,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;
@@ -5951,7 +5947,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,
@@ -5970,6 +5966,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