diff options
author | ericek111 <[email protected]> | 2020-11-25 10:50:46 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2020-11-28 23:01:19 +0100 |
commit | 127feaea2d4ffd62666673f99e73153857a7e63e (patch) | |
tree | 6e159e6fbbb11d513f32006c49e49b6b92b6fcd7 | |
parent | e69fc06d75d2d9a2ba2239791196dcc48801ab68 (diff) | |
download | caja-127feaea2d4ffd62666673f99e73153857a7e63e.tar.bz2 caja-127feaea2d4ffd62666673f99e73153857a7e63e.tar.xz |
file-operations: don't attempt to move into the source dir
-rw-r--r-- | libcaja-private/caja-file-operations.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/libcaja-private/caja-file-operations.c b/libcaja-private/caja-file-operations.c index 017aa5cb..e6dcdb98 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 |