Commit 37ec9edf authored by William Jon McCann's avatar William Jon McCann

Don't allow any type of drop (even text) if the target is readonly

https://bugzilla.gnome.org/show_bug.cgi?id=329515
parent d90c4021
......@@ -1144,28 +1144,23 @@ nautilus_canvas_container_get_drop_action (NautilusCanvasContainer *container,
canvas_widget_to_world (EEL_CANVAS (container), x, y, &world_x, &world_y);
*action = 0;
drop_target = nautilus_canvas_container_find_drop_target (container,
context, x, y, &icon_hit, FALSE);
if (drop_target == NULL) {
return;
}
/* case out on the type of object being dragged */
switch (container->details->dnd_info->drag_info.data_type) {
case NAUTILUS_ICON_DND_GNOME_ICON_LIST:
if (container->details->dnd_info->drag_info.selection_list == NULL) {
return;
}
drop_target = nautilus_canvas_container_find_drop_target (container,
context, x, y, &icon_hit, FALSE);
if (!drop_target) {
return;
if (container->details->dnd_info->drag_info.selection_list != NULL) {
nautilus_drag_default_drop_action_for_icons (context, drop_target,
container->details->dnd_info->drag_info.selection_list,
action);
}
nautilus_drag_default_drop_action_for_icons (context, drop_target,
container->details->dnd_info->drag_info.selection_list,
action);
g_free (drop_target);
break;
case NAUTILUS_ICON_DND_URI_LIST:
drop_target = nautilus_canvas_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;
case NAUTILUS_ICON_DND_NETSCAPE_URL:
......@@ -1182,6 +1177,8 @@ nautilus_canvas_container_get_drop_action (NautilusCanvasContainer *container,
*action = GDK_ACTION_COPY;
break;
}
g_free (drop_target);
}
static void
......
......@@ -368,14 +368,19 @@ get_drop_target_uri_for_path (NautilusTreeViewDragDest *dest,
GtkTreePath *path)
{
NautilusFile *file;
char *target;
char *target = NULL;
gboolean can;
file = file_for_path (dest, path);
if (file == NULL) {
return NULL;
}
target = nautilus_file_get_drop_target_uri (file);
can = nautilus_drag_can_accept_info (file,
dest->details->drag_type,
dest->details->drag_list);
if (can) {
target = nautilus_file_get_drop_target_uri (file);
}
nautilus_file_unref (file);
return target;
......@@ -395,56 +400,36 @@ get_drop_action (NautilusTreeViewDragDest *dest,
return 0;
}
drop_target = get_drop_target_uri_for_path (dest, path);
if (drop_target == NULL) {
return 0;
}
action = 0;
switch (dest->details->drag_type) {
case NAUTILUS_ICON_DND_GNOME_ICON_LIST :
drop_target = get_drop_target_uri_for_path (dest, path);
if (!drop_target) {
return 0;
}
nautilus_drag_default_drop_action_for_icons
(context,
drop_target,
dest->details->drag_list,
&action);
g_free (drop_target);
return action;
break;
case NAUTILUS_ICON_DND_NETSCAPE_URL:
drop_target = get_drop_target_uri_for_path (dest, path);
if (drop_target == NULL) {
return 0;
}
action = nautilus_drag_default_drop_action_for_netscape_url (context);
g_free (drop_target);
return action;
break;
case NAUTILUS_ICON_DND_URI_LIST :
drop_target = get_drop_target_uri_for_path (dest, path);
if (drop_target == NULL) {
return 0;
}
g_free (drop_target);
return gdk_drag_context_get_suggested_action (context);
action = gdk_drag_context_get_suggested_action (context);
break;
case NAUTILUS_ICON_DND_TEXT:
case NAUTILUS_ICON_DND_RAW:
case NAUTILUS_ICON_DND_XDNDDIRECTSAVE:
return GDK_ACTION_COPY;
action = GDK_ACTION_COPY;
break;
}
return 0;
g_free (drop_target);
return action;
}
static gboolean
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment