diff options
author | robertxgray <[email protected]> | 2021-03-19 17:13:53 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2022-07-21 19:33:51 +0200 |
commit | 70e891c66cede8fef74004b6c5740466e4d90eb4 (patch) | |
tree | 514eeacb819ea4cfb3f690121db804f232560359 /libcaja-private/caja-dnd.c | |
parent | 18e1d60e2fb94ca5d511d96fad6a259fad5b4f52 (diff) | |
download | caja-70e891c66cede8fef74004b6c5740466e4d90eb4.tar.bz2 caja-70e891c66cede8fef74004b6c5740466e4d90eb4.tar.xz |
Improved filesystem check on dnd
Diffstat (limited to 'libcaja-private/caja-dnd.c')
-rw-r--r-- | libcaja-private/caja-dnd.c | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/libcaja-private/caja-dnd.c b/libcaja-private/caja-dnd.c index 7a16a8f5..08b11719 100644 --- a/libcaja-private/caja-dnd.c +++ b/libcaja-private/caja-dnd.c @@ -374,29 +374,43 @@ caja_drag_default_drop_action_for_netscape_url (GdkDragContext *context) } static gboolean -check_same_fs (CajaFile *file1, - CajaFile *file2) +check_same_fs (const char *target_uri, + CajaFile *target_file, + const char *dropped_uri, + CajaFile *dropped_file) { gboolean result; result = FALSE; - if (file1 != NULL && file2 != NULL) - { - char *id1, *id2; + char *target_fs = NULL, *dropped_fs = NULL; - id1 = caja_file_get_filesystem_id (file1); - id2 = caja_file_get_filesystem_id (file2); + if (target_file != NULL) + { + target_fs = caja_file_get_filesystem_id (target_file); + } + if (target_fs == NULL) + { + target_fs = caja_get_filesystem_id_by_uri (target_uri, TRUE); + } - if (id1 != NULL && id2 != NULL) - { - result = (strcmp (id1, id2) == 0); - } + if (dropped_file != NULL && !caja_file_is_symbolic_link (dropped_file)) + { + dropped_fs = caja_file_get_filesystem_id (dropped_file); + } + if (dropped_fs == NULL) + { + dropped_fs = caja_get_filesystem_id_by_uri (dropped_uri, FALSE); + } - g_free (id1); - g_free (id2); + if (target_fs != NULL && dropped_fs != NULL) + { + result = (strcmp (target_fs, dropped_fs) == 0); } + g_free (target_fs); + g_free (dropped_fs); + return result; } @@ -519,7 +533,7 @@ caja_drag_default_drop_action_for_icons (GdkDragContext *context, target = g_file_new_for_uri (target_uri_string); } - same_fs = check_same_fs (target_file, dropped_file); + same_fs = check_same_fs (target_uri_string, target_file, dropped_uri, dropped_file); caja_file_unref (dropped_file); caja_file_unref (target_file); |