static gboolean slot_proxy_drag_motion (GtkWidget *widget, GdkDragContext *context, int x, int y, unsigned int time, gpointer user_data) { NautilusDragSlotProxyInfo *drag_info; NautilusWindowSlot *target_slot; GtkWidget *window; GdkAtom target; int action; char *target_uri; GFile *location; gboolean valid_text_drag; gboolean valid_xds_drag; drag_info = user_data; action = 0; valid_text_drag = FALSE; valid_xds_drag = FALSE; if (gtk_drag_get_source_widget (context) == widget) { goto out; } window = gtk_widget_get_toplevel (widget); g_assert (NAUTILUS_IS_WINDOW (window)); if (!drag_info->have_data) { target = gtk_drag_dest_find_target (widget, context, NULL); if (target == GDK_NONE) { goto out; } gtk_drag_get_data (widget, context, target, time); } target_uri = NULL; if (drag_info->target_file != NULL) { target_uri = nautilus_file_get_uri (drag_info->target_file); } else { if (drag_info->target_slot != NULL) { target_slot = drag_info->target_slot; } else { target_slot = nautilus_window_get_active_slot (NAUTILUS_WINDOW (window)); } if (target_slot != NULL) { location = nautilus_window_slot_get_location (target_slot); target_uri = g_file_get_uri (location); } } if (target_uri != NULL) { NautilusFile *file; gboolean can; file = nautilus_file_get_existing_by_uri (target_uri); can = nautilus_file_can_write (file); g_object_unref (file); if (!can) { action = 0; goto out; } } if (drag_info->have_data && drag_info->have_valid_data) { if (drag_info->info == NAUTILUS_ICON_DND_GNOME_ICON_LIST) { nautilus_drag_default_drop_action_for_icons (context, target_uri, drag_info->data.selection_list, 0, &action); } else if (drag_info->info == NAUTILUS_ICON_DND_URI_LIST) { action = nautilus_drag_default_drop_action_for_uri_list (context, target_uri); } else if (drag_info->info == NAUTILUS_ICON_DND_NETSCAPE_URL) { action = nautilus_drag_default_drop_action_for_netscape_url (context); } else if (drag_info->info == NAUTILUS_ICON_DND_TEXT) { valid_text_drag = TRUE; } else if (drag_info->info == NAUTILUS_ICON_DND_XDNDDIRECTSAVE || drag_info->info == NAUTILUS_ICON_DND_RAW) { valid_xds_drag = TRUE; } } g_free (target_uri); out: if (action != 0 || valid_text_drag || valid_xds_drag) { gtk_drag_highlight (widget); slot_proxy_check_switch_location_timer (drag_info, widget); } else { gtk_drag_unhighlight (widget); slot_proxy_remove_switch_location_timer (drag_info); } gdk_drag_status (context, action, time); return TRUE; }
static gboolean slot_proxy_drag_motion (GtkWidget *widget, GdkDragContext *context, int x, int y, unsigned int time, gpointer user_data) { NautilusDragSlotProxyInfo *drag_info; NautilusWindowSlot *target_slot; GtkWidget *window; GdkAtom target; int action; char *target_uri; drag_info = user_data; action = 0; if (gtk_drag_get_source_widget (context) == widget) { goto out; } window = gtk_widget_get_toplevel (widget); g_assert (NAUTILUS_IS_WINDOW (window)); if (!drag_info->have_data) { target = gtk_drag_dest_find_target (widget, context, NULL); if (target == GDK_NONE) { goto out; } gtk_drag_get_data (widget, context, target, time); } target_uri = NULL; if (drag_info->target_location != NULL) { target_uri = g_file_get_uri (drag_info->target_location); } else { if (drag_info->target_slot != NULL) { target_slot = drag_info->target_slot; } else { target_slot = nautilus_window_get_active_slot (NAUTILUS_WINDOW (window)); } if (target_slot != NULL) { target_uri = nautilus_window_slot_get_current_uri (target_slot); } } if (drag_info->have_data && drag_info->have_valid_data) { if (drag_info->info == NAUTILUS_ICON_DND_GNOME_ICON_LIST) { nautilus_drag_default_drop_action_for_icons (context, target_uri, drag_info->data.selection_list, &action); } else if (drag_info->info == NAUTILUS_ICON_DND_URI_LIST) { action = nautilus_drag_default_drop_action_for_uri_list (context, target_uri); } else if (drag_info->info == NAUTILUS_ICON_DND_NETSCAPE_URL) { action = nautilus_drag_default_drop_action_for_netscape_url (context); } } g_free (target_uri); out: if (action != 0) { gtk_drag_highlight (widget); } else { gtk_drag_unhighlight (widget); } gdk_drag_status (context, action, time); return TRUE; }