1
From dba89439ee41f3cc793b44d9dc3630e3238228db Mon Sep 17 00:00:00 2001
2
From: Eric Koegel <eric.koegel@gmail.com>
3
Date: Sun, 19 Feb 2012 09:32:01 +0300
4
Subject: Fix for moving files instead of copy when src isn't writable
6
Fixed a bug where a user drags and drops a file from a folder on the
7
same filesystem as the desktop but the src isn't writable by the user
8
so they can't delete the src file. The user will still see an error
9
message if they explicitly try to move the file via the right click
12
src/xfdesktop-file-icon-manager.c | 13 +++++++++----
13
1 files changed, 9 insertions(+), 4 deletions(-)
15
diff --git a/src/xfdesktop-file-icon-manager.c b/src/xfdesktop-file-icon-manager.c
16
index 4a19539..2deb0a1 100644
17
--- a/src/xfdesktop-file-icon-manager.c
18
+++ b/src/xfdesktop-file-icon-manager.c
19
@@ -3097,18 +3097,20 @@ xfdesktop_file_icon_manager_drag_data_received(XfdesktopIconViewManager *manager
21
/* If the user didn't pick whether to copy or move via
22
* a GDK_ACTION_ASK then determine if we should move/copy
23
- * by checking if the files are on the same file system.
24
+ * by checking if the files are on the same filesystem
25
+ * and are writable by the user.
27
if(user_selected_action == FALSE) {
28
GFileInfo *src_info, *dest_info;
29
const gchar *src_name, *dest_name;
31
dest_info = g_file_query_info(base_dest_file,
32
- G_FILE_ATTRIBUTE_ID_FILESYSTEM,
33
+ XFDESKTOP_FILE_INFO_NAMESPACE,
34
G_FILE_QUERY_INFO_NONE,
37
src_info = g_file_query_info(file_list->data,
38
- G_FILE_ATTRIBUTE_ID_FILESYSTEM,
39
+ XFDESKTOP_FILE_INFO_NAMESPACE,
40
G_FILE_QUERY_INFO_NONE,
43
@@ -3119,7 +3121,10 @@ xfdesktop_file_icon_manager_drag_data_received(XfdesktopIconViewManager *manager
44
src_name = g_file_info_get_attribute_string(src_info,
45
G_FILE_ATTRIBUTE_ID_FILESYSTEM);
47
- if(g_strcmp0(src_name, dest_name) == 0) {
48
+ if((g_strcmp0(src_name, dest_name) == 0)
49
+ && g_file_info_get_attribute_boolean(src_info,
50
+ G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE))
53
context->action = GDK_ACTION_MOVE;