nautilus r14719 - in trunk: . libnautilus-private
- From: nbenitez svn gnome org
- To: svn-commits-list gnome org
- Subject: nautilus r14719 - in trunk: . libnautilus-private
- Date: Sun, 12 Oct 2008 15:18:42 +0000 (UTC)
Author: nbenitez
Date: Sun Oct 12 15:18:42 2008
New Revision: 14719
URL: http://svn.gnome.org/viewvc/nautilus?rev=14719&view=rev
Log:
2008-10-12 Nelson BenÃtez LeÃn <nbenitez svn gnome org>
* libnautilus-private/nautilus-dnd.c
(nautilus_drag_default_drop_action_for_icons):
Add new function source_is_deletable.
When DnD'ing, change the drop action to COPY instead of MOVE, when
the source is not deletable. Fixes #314139.
Modified:
trunk/ChangeLog
trunk/libnautilus-private/nautilus-dnd.c
Modified: trunk/libnautilus-private/nautilus-dnd.c
==============================================================================
--- trunk/libnautilus-private/nautilus-dnd.c (original)
+++ trunk/libnautilus-private/nautilus-dnd.c Sun Oct 12 15:18:42 2008
@@ -410,6 +410,24 @@
return result;
}
+static gboolean
+source_is_deletable (GFile *file)
+{
+ NautilusFile *naut_file;
+ gboolean ret;
+
+ /* if there's no a cached NautilusFile, it returns NULL */
+ naut_file = nautilus_file_get_existing (file);
+ if (naut_file == NULL) {
+ return FALSE;
+ }
+
+ ret = nautilus_file_can_delete (naut_file);
+ nautilus_file_unref (naut_file);
+
+ return ret;
+}
+
void
nautilus_drag_default_drop_action_for_icons (GdkDragContext *context,
const char *target_uri_string, const GList *items,
@@ -417,6 +435,7 @@
{
gboolean same_fs;
gboolean target_is_source_parent;
+ gboolean source_deletable;
const char *dropped_uri;
GFile *target, *dropped;
GdkDragAction actions;
@@ -501,8 +520,9 @@
/* Compare the first dropped uri with the target uri for same fs match. */
dropped = g_file_new_for_uri (dropped_uri);
target_is_source_parent = g_file_has_prefix (dropped, target);
-
- if (same_fs || target_is_source_parent ||
+ source_deletable = source_is_deletable (dropped);
+
+ if ((same_fs && source_deletable) || target_is_source_parent ||
g_file_has_uri_scheme (dropped, "trash")) {
if (actions & GDK_ACTION_MOVE) {
*action = GDK_ACTION_MOVE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]