[Xfce4-commits] <xfdesktop:master> Fix for moving files instead of copy when src isn't writable
Eric Koegel
noreply at xfce.org
Mon Mar 5 19:30:12 CET 2012
Updating branch refs/heads/master
to dba89439ee41f3cc793b44d9dc3630e3238228db (commit)
from 578732b85aee34d0d48b4c16ac9ef398b644a9fc (commit)
commit dba89439ee41f3cc793b44d9dc3630e3238228db
Author: Eric Koegel <eric.koegel at gmail.com>
Date: Sun Feb 19 09:32:01 2012 +0300
Fix for moving files instead of copy when src isn't writable
Fixed a bug where a user drags and drops a file from a folder on the
same filesystem as the desktop but the src isn't writable by the user
so they can't delete the src file. The user will still see an error
message if they explicitly try to move the file via the right click
drag and drop menu.
src/xfdesktop-file-icon-manager.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/xfdesktop-file-icon-manager.c b/src/xfdesktop-file-icon-manager.c
index 4a19539..2deb0a1 100644
--- a/src/xfdesktop-file-icon-manager.c
+++ b/src/xfdesktop-file-icon-manager.c
@@ -3097,18 +3097,20 @@ xfdesktop_file_icon_manager_drag_data_received(XfdesktopIconViewManager *manager
/* If the user didn't pick whether to copy or move via
* a GDK_ACTION_ASK then determine if we should move/copy
- * by checking if the files are on the same file system.
+ * by checking if the files are on the same filesystem
+ * and are writable by the user.
*/
if(user_selected_action == FALSE) {
GFileInfo *src_info, *dest_info;
const gchar *src_name, *dest_name;
+
dest_info = g_file_query_info(base_dest_file,
- G_FILE_ATTRIBUTE_ID_FILESYSTEM,
+ XFDESKTOP_FILE_INFO_NAMESPACE,
G_FILE_QUERY_INFO_NONE,
NULL,
NULL);
src_info = g_file_query_info(file_list->data,
- G_FILE_ATTRIBUTE_ID_FILESYSTEM,
+ XFDESKTOP_FILE_INFO_NAMESPACE,
G_FILE_QUERY_INFO_NONE,
NULL,
NULL);
@@ -3119,7 +3121,10 @@ xfdesktop_file_icon_manager_drag_data_received(XfdesktopIconViewManager *manager
src_name = g_file_info_get_attribute_string(src_info,
G_FILE_ATTRIBUTE_ID_FILESYSTEM);
- if(g_strcmp0(src_name, dest_name) == 0) {
+ if((g_strcmp0(src_name, dest_name) == 0)
+ && g_file_info_get_attribute_boolean(src_info,
+ G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE))
+ {
copy_only = FALSE;
context->action = GDK_ACTION_MOVE;
}
More information about the Xfce4-commits
mailing list