mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-11-05 16:04:31 +00:00
Fixed bug 2134, items cannot be dragged from desktop or windows onto Trash
2000-09-07 Gene Z. Ragan <gzr@eazel.com> Fixed bug 2134, items cannot be dragged from desktop or windows onto Trash icon. * libnautilus-extensions/nautilus-drag.c: (nautilus_drag_default_drop_action_for_icons): Check and see if target is trash: URI. If it is, use find_directory to locate the actual trash directory URI. * libnautilus-extensions/nautilus-file-operations.c: (nautilus_file_operations_copy_move): Check and see if target is trash: URI. If it is, use find_directory to locate the actual trash directory URI for the volume of the source file.
This commit is contained in:
parent
15b64a42bd
commit
9ba8f4750b
5 changed files with 71 additions and 14 deletions
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,20 @@
|
|||
2000-09-07 Gene Z. Ragan <gzr@eazel.com>
|
||||
|
||||
Fixed bug 2134, items cannot be dragged from desktop or windows
|
||||
onto Trash icon.
|
||||
|
||||
* libnautilus-extensions/nautilus-drag.c:
|
||||
(nautilus_drag_default_drop_action_for_icons):
|
||||
Check and see if target is trash: URI. If it is,
|
||||
use find_directory to locate the actual trash directory
|
||||
URI.
|
||||
|
||||
* libnautilus-extensions/nautilus-file-operations.c:
|
||||
(nautilus_file_operations_copy_move):
|
||||
Check and see if target is trash: URI. If it is,
|
||||
use find_directory to locate the actual trash directory
|
||||
URI for the volume of the source file.
|
||||
|
||||
2000-09-07 Michael Engber <engber@eazel.com>
|
||||
|
||||
Added Robin to the about box.
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <config.h>
|
||||
#include "nautilus-drag.h"
|
||||
|
||||
#include <libgnomevfs/gnome-vfs-find-directory.h>
|
||||
#include <libgnomevfs/gnome-vfs-types.h>
|
||||
#include <libgnomevfs/gnome-vfs-uri.h>
|
||||
#include <libgnomevfs/gnome-vfs-ops.h>
|
||||
|
@ -293,7 +294,8 @@ nautilus_drag_default_drop_action_for_icons (GdkDragContext *context,
|
|||
GnomeVFSURI *target_uri;
|
||||
GnomeVFSURI *dropped_uri;
|
||||
GdkDragAction actions;
|
||||
|
||||
GnomeVFSResult result;
|
||||
|
||||
if (target_uri_string == NULL) {
|
||||
*default_action = 0;
|
||||
*non_default_action = 0;
|
||||
|
@ -313,11 +315,21 @@ nautilus_drag_default_drop_action_for_icons (GdkDragContext *context,
|
|||
*/
|
||||
*default_action = context->suggested_action;
|
||||
*non_default_action = context->suggested_action;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
target_uri = gnome_vfs_uri_new (target_uri_string);
|
||||
|
||||
/* Check for trash: URI. We do a find_directory for any Trash directory. */
|
||||
if (strcmp (target_uri_string, "trash:") == 0) {
|
||||
result = gnome_vfs_find_directory (NULL, GNOME_VFS_DIRECTORY_KIND_TRASH,
|
||||
&target_uri, FALSE, FALSE, 0777);
|
||||
if (result != GNOME_VFS_OK) {
|
||||
*default_action = 0;
|
||||
*non_default_action = 0;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
target_uri = gnome_vfs_uri_new (target_uri_string);
|
||||
}
|
||||
|
||||
/* Compare the first dropped uri with the target uri for same fs match. */
|
||||
dropped_uri = gnome_vfs_uri_new (((DragSelectionItem *)items->data)->uri);
|
||||
|
|
|
@ -669,10 +669,10 @@ nautilus_file_operations_copy_move (const GList *item_uris,
|
|||
GnomeVFSURI *trash_dir_uri;
|
||||
GnomeVFSURI *uri;
|
||||
|
||||
|
||||
XferInfo *xfer_info;
|
||||
GnomeVFSResult result;
|
||||
gboolean same_fs;
|
||||
gboolean is_trash_move;
|
||||
|
||||
g_assert (item_uris != NULL);
|
||||
|
||||
|
@ -683,6 +683,7 @@ nautilus_file_operations_copy_move (const GList *item_uris,
|
|||
source_uri_list = NULL;
|
||||
target_uri_list = NULL;
|
||||
same_fs = TRUE;
|
||||
is_trash_move = FALSE;
|
||||
|
||||
move_options = GNOME_VFS_XFER_RECURSIVE;
|
||||
|
||||
|
@ -691,10 +692,13 @@ nautilus_file_operations_copy_move (const GList *item_uris,
|
|||
g_assert (copy_action != GDK_ACTION_MOVE);
|
||||
move_options |= GNOME_VFS_XFER_USE_UNIQUE_NAMES;
|
||||
} else {
|
||||
target_dir_uri = new_uri_from_escaped_string (target_dir);
|
||||
if (strcmp (target_dir, "trash:") == 0) {
|
||||
is_trash_move = TRUE;
|
||||
} else {
|
||||
target_dir_uri = new_uri_from_escaped_string (target_dir);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* build the source and target URI lists and figure out if all the files are on the
|
||||
* same disk
|
||||
*/
|
||||
|
@ -703,6 +707,10 @@ nautilus_file_operations_copy_move (const GList *item_uris,
|
|||
source_uri_list = g_list_prepend (source_uri_list, gnome_vfs_uri_ref (source_uri));
|
||||
|
||||
if (target_dir != NULL) {
|
||||
if (is_trash_move) {
|
||||
gnome_vfs_find_directory (source_uri, GNOME_VFS_DIRECTORY_KIND_TRASH,
|
||||
&target_dir_uri, FALSE, FALSE, 0777);
|
||||
}
|
||||
target_uri = append_basename_unescaped (target_dir_uri, source_uri);
|
||||
} else {
|
||||
/* duplication */
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <config.h>
|
||||
#include "nautilus-drag.h"
|
||||
|
||||
#include <libgnomevfs/gnome-vfs-find-directory.h>
|
||||
#include <libgnomevfs/gnome-vfs-types.h>
|
||||
#include <libgnomevfs/gnome-vfs-uri.h>
|
||||
#include <libgnomevfs/gnome-vfs-ops.h>
|
||||
|
@ -293,7 +294,8 @@ nautilus_drag_default_drop_action_for_icons (GdkDragContext *context,
|
|||
GnomeVFSURI *target_uri;
|
||||
GnomeVFSURI *dropped_uri;
|
||||
GdkDragAction actions;
|
||||
|
||||
GnomeVFSResult result;
|
||||
|
||||
if (target_uri_string == NULL) {
|
||||
*default_action = 0;
|
||||
*non_default_action = 0;
|
||||
|
@ -313,11 +315,21 @@ nautilus_drag_default_drop_action_for_icons (GdkDragContext *context,
|
|||
*/
|
||||
*default_action = context->suggested_action;
|
||||
*non_default_action = context->suggested_action;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
target_uri = gnome_vfs_uri_new (target_uri_string);
|
||||
|
||||
/* Check for trash: URI. We do a find_directory for any Trash directory. */
|
||||
if (strcmp (target_uri_string, "trash:") == 0) {
|
||||
result = gnome_vfs_find_directory (NULL, GNOME_VFS_DIRECTORY_KIND_TRASH,
|
||||
&target_uri, FALSE, FALSE, 0777);
|
||||
if (result != GNOME_VFS_OK) {
|
||||
*default_action = 0;
|
||||
*non_default_action = 0;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
target_uri = gnome_vfs_uri_new (target_uri_string);
|
||||
}
|
||||
|
||||
/* Compare the first dropped uri with the target uri for same fs match. */
|
||||
dropped_uri = gnome_vfs_uri_new (((DragSelectionItem *)items->data)->uri);
|
||||
|
|
|
@ -669,10 +669,10 @@ nautilus_file_operations_copy_move (const GList *item_uris,
|
|||
GnomeVFSURI *trash_dir_uri;
|
||||
GnomeVFSURI *uri;
|
||||
|
||||
|
||||
XferInfo *xfer_info;
|
||||
GnomeVFSResult result;
|
||||
gboolean same_fs;
|
||||
gboolean is_trash_move;
|
||||
|
||||
g_assert (item_uris != NULL);
|
||||
|
||||
|
@ -683,6 +683,7 @@ nautilus_file_operations_copy_move (const GList *item_uris,
|
|||
source_uri_list = NULL;
|
||||
target_uri_list = NULL;
|
||||
same_fs = TRUE;
|
||||
is_trash_move = FALSE;
|
||||
|
||||
move_options = GNOME_VFS_XFER_RECURSIVE;
|
||||
|
||||
|
@ -691,10 +692,13 @@ nautilus_file_operations_copy_move (const GList *item_uris,
|
|||
g_assert (copy_action != GDK_ACTION_MOVE);
|
||||
move_options |= GNOME_VFS_XFER_USE_UNIQUE_NAMES;
|
||||
} else {
|
||||
target_dir_uri = new_uri_from_escaped_string (target_dir);
|
||||
if (strcmp (target_dir, "trash:") == 0) {
|
||||
is_trash_move = TRUE;
|
||||
} else {
|
||||
target_dir_uri = new_uri_from_escaped_string (target_dir);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* build the source and target URI lists and figure out if all the files are on the
|
||||
* same disk
|
||||
*/
|
||||
|
@ -703,6 +707,10 @@ nautilus_file_operations_copy_move (const GList *item_uris,
|
|||
source_uri_list = g_list_prepend (source_uri_list, gnome_vfs_uri_ref (source_uri));
|
||||
|
||||
if (target_dir != NULL) {
|
||||
if (is_trash_move) {
|
||||
gnome_vfs_find_directory (source_uri, GNOME_VFS_DIRECTORY_KIND_TRASH,
|
||||
&target_dir_uri, FALSE, FALSE, 0777);
|
||||
}
|
||||
target_uri = append_basename_unescaped (target_dir_uri, source_uri);
|
||||
} else {
|
||||
/* duplication */
|
||||
|
|
Loading…
Reference in a new issue