summaryrefslogtreecommitdiff
path: root/libnautilus-extensions/nautilus-icon-dnd.c
diff options
context:
space:
mode:
authorGene Z. Ragan <gzr@eazel.com>2000-08-23 01:56:53 +0000
committerGene Ragan <gzr@src.gnome.org>2000-08-23 01:56:53 +0000
commit3184fe2b0a38ba2835c71b10423af7c24f6f0106 (patch)
tree0b825f3e657c045bedb85b1ef55bf4cd57523186 /libnautilus-extensions/nautilus-icon-dnd.c
parent136ddd80dd9888cc2e48818d6da5431bc4ea95f2 (diff)
downloadnautilus-3184fe2b0a38ba2835c71b10423af7c24f6f0106.tar.gz
Work in progress to support dragging onto NautilusLink files. Dragging on
2000-08-22 Gene Z. Ragan <gzr@eazel.com> Work in progress to support dragging onto NautilusLink files. Dragging on the trash still does not work. * libnautilus-extensions/nautilus-icon-container.c: * libnautilus-extensions/nautilus-icon-container.h: (nautilus_icon_container_initialize_class), (nautilus_icon_container_get_icon_uri), (nautilus_icon_container_get_icon_drop_target_uri): New signal to return the target URI of a drag target. This was done to support dragging onto NautilyusLink files. * libnautilus-extensions/nautilus-drag.c: (nautilus_drag_can_accept_item): Add call to nautilus_icon_container_get_icon_drop_target_uri and remove call to nautilus_icon_container_get_icon_uri * libnautilus-extensions/nautilus-icon-dnd.c: * libnautilus-extensions/nautilus-icon-private.h: (nautilus_icon_container_find_drop_target): Some code cleanup to fix a leak. * libnautilus-extensions/nautilus-link.c: * libnautilus-extensions/nautilus-link.h: (nautilus_link_can_accept_drag): New function that currently return TRUE for all links. * src/file-manager/fm-icon-view.c: (get_icon_uri_callback), (get_icon_drop_target_uri_callback), (create_icon_container): Connect to new signal and add implementation.
Diffstat (limited to 'libnautilus-extensions/nautilus-icon-dnd.c')
-rw-r--r--libnautilus-extensions/nautilus-icon-dnd.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/libnautilus-extensions/nautilus-icon-dnd.c b/libnautilus-extensions/nautilus-icon-dnd.c
index bd9fa3581..46b32f2d5 100644
--- a/libnautilus-extensions/nautilus-icon-dnd.c
+++ b/libnautilus-extensions/nautilus-icon-dnd.c
@@ -41,11 +41,12 @@
#include <libgnome/gnome-i18n.h>
#include <libgnomeui/gnome-stock.h>
#include <libgnomeui/gnome-canvas-rect-ellipse.h>
+
+#include "nautilus-background.h"
#include "nautilus-glib-extensions.h"
#include "nautilus-gtk-extensions.h"
#include "nautilus-gtk-macros.h"
#include "nautilus-gnome-extensions.h"
-#include "nautilus-background.h"
#include "nautilus-graphic-effects.h"
#include "nautilus-stock-dialogs.h"
#include "nautilus-string.h"
@@ -813,6 +814,8 @@ nautilus_icon_container_find_drop_target (NautilusIconContainer *container,
{
NautilusIcon *drop_target_icon;
double world_x, world_y;
+ NautilusFile *file;
+ char *icon_uri;
if (container->details->dnd_info->drag_info.selection_list == NULL) {
return NULL;
@@ -826,28 +829,34 @@ nautilus_icon_container_find_drop_target (NautilusIconContainer *container,
* that the target is a file.
*/
- /* Find the item we hit with our drop, if any */
+ /* Find the item we hit with our drop, if any */
drop_target_icon = nautilus_icon_container_item_at (container, world_x, world_y);
- if (drop_target_icon != NULL
- && !nautilus_drag_can_accept_items
- (nautilus_file_get (
- nautilus_icon_container_get_icon_uri
- (container, drop_target_icon)),
- container->details->dnd_info->drag_info.selection_list)) {
- /* the item we dropped our selection on cannot accept the items,
- * do the same thing as if we just dropped the items on the canvas
- */
- drop_target_icon = NULL;
+ if (drop_target_icon != NULL) {
+ icon_uri = nautilus_icon_container_get_icon_uri (container, drop_target_icon);
+ if (icon_uri != NULL) {
+ file = nautilus_file_get (icon_uri);
+
+ if ( !nautilus_drag_can_accept_items (file,
+ container->details->dnd_info->drag_info.selection_list)) {
+ /* the item we dropped our selection on cannot accept the items,
+ * do the same thing as if we just dropped the items on the canvas
+ */
+ drop_target_icon = NULL;
+ }
+
+ g_free (icon_uri);
+ nautilus_file_unref (file);
+ }
}
- if (!drop_target_icon) {
+ if (drop_target_icon == NULL) {
*icon_hit = FALSE;
return get_container_uri (container);
}
-
*icon_hit = TRUE;
- return nautilus_icon_container_get_icon_uri (container, drop_target_icon);
+
+ return nautilus_icon_container_get_icon_drop_target_uri (container, drop_target_icon);
}
static void