nautilus r14201 - in branches/gnome-2-22: . libnautilus-private



Author: cosimoc
Date: Mon May 26 22:09:47 2008
New Revision: 14201
URL: http://svn.gnome.org/viewvc/nautilus?rev=14201&view=rev

Log:
2008-05-27  Cosimo Cecchi  <cosimoc gnome org>

	* libnautilus-private/nautilus-dnd.c:
	(nautilus_drag_default_drop_action_for_uri_list):
	* libnautilus-private/nautilus-dnd.h:
	* libnautilus-private/nautilus-icon-dnd.c:
	(nautilus_icon_container_get_drop_action):
	Select GDK_ACTION_MOVE as default action when DnD-ing a uri list
	into the trash. (#534769).


Modified:
   branches/gnome-2-22/ChangeLog
   branches/gnome-2-22/libnautilus-private/nautilus-dnd.c
   branches/gnome-2-22/libnautilus-private/nautilus-dnd.h
   branches/gnome-2-22/libnautilus-private/nautilus-icon-dnd.c

Modified: branches/gnome-2-22/libnautilus-private/nautilus-dnd.c
==============================================================================
--- branches/gnome-2-22/libnautilus-private/nautilus-dnd.c	(original)
+++ branches/gnome-2-22/libnautilus-private/nautilus-dnd.c	Mon May 26 22:09:47 2008
@@ -453,6 +453,18 @@
 	
 }
 
+GdkDragAction
+nautilus_drag_default_drop_action_for_uri_list (GdkDragContext *context,
+						const char *target_uri_string)
+{
+	if (eel_uri_is_trash (target_uri_string) && (context->actions & GDK_ACTION_MOVE)) {
+		/* Only move to Trash */
+		return GDK_ACTION_MOVE;
+	} else {
+		return context->suggested_action;
+	}
+}
+
 /* Encode a "x-special/gnome-icon-list" selection.
    Along with the URIs of the dragged files, this encodes
    the location and size of each icon relative to the cursor.

Modified: branches/gnome-2-22/libnautilus-private/nautilus-dnd.h
==============================================================================
--- branches/gnome-2-22/libnautilus-private/nautilus-dnd.h	(original)
+++ branches/gnome-2-22/libnautilus-private/nautilus-dnd.h	Mon May 26 22:09:47 2008
@@ -126,6 +126,8 @@
 									 const GList                          *items,
 									 int                                  *action);
 GdkDragAction               nautilus_drag_default_drop_action_for_netscape_url (GdkDragContext                       *context);
+GdkDragAction		    nautilus_drag_default_drop_action_for_uri_list     (GdkDragContext                       *context,
+										const char                           *target_uri_string);
 gboolean                    nautilus_drag_drag_data_get                 (GtkWidget                            *widget,
 									 GdkDragContext                       *context,
 									 GtkSelectionData                     *selection_data,

Modified: branches/gnome-2-22/libnautilus-private/nautilus-icon-dnd.c
==============================================================================
--- branches/gnome-2-22/libnautilus-private/nautilus-icon-dnd.c	(original)
+++ branches/gnome-2-22/libnautilus-private/nautilus-icon-dnd.c	Mon May 26 22:09:47 2008
@@ -1278,6 +1278,13 @@
 							     action);
 		g_free (drop_target);
 		break;
+	case NAUTILUS_ICON_DND_URI_LIST:
+		drop_target = nautilus_icon_container_find_drop_target (container,
+									context, x, y, &icon_hit, FALSE);
+		*action = nautilus_drag_default_drop_action_for_uri_list (context, drop_target);
+
+		g_free (drop_target);
+		break;
 
 	/* handle emblems by setting the action if we're over an object */
 	case NAUTILUS_ICON_DND_KEYWORD:
@@ -1293,7 +1300,6 @@
 	case NAUTILUS_ICON_DND_COLOR:
 	case NAUTILUS_ICON_DND_BGIMAGE:
 	case NAUTILUS_ICON_DND_RESET_BACKGROUND:
-	case NAUTILUS_ICON_DND_URI_LIST:
 	case NAUTILUS_ICON_DND_ROOTWINDOW_DROP:
 		*action = context->suggested_action;
 		break;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]