Commit 1d1488cb authored by Cosimo Cecchi's avatar Cosimo Cecchi

Always use activation URI for DnD sources

This ensures DnD from special locations (e.g. Recent or Trash) always
works even for targets that do not use gvfs.
parent 26d023a2
......@@ -226,6 +226,7 @@ enum {
MIDDLE_CLICK,
GET_CONTAINER_URI,
GET_ICON_URI,
GET_ICON_ACTIVATION_URI,
GET_ICON_DROP_TARGET_URI,
GET_STORED_ICON_POSITION,
ICON_POSITION_CHANGED,
......@@ -4847,6 +4848,16 @@ nautilus_canvas_container_class_init (NautilusCanvasContainerClass *class)
g_cclosure_marshal_generic,
G_TYPE_STRING, 1,
G_TYPE_POINTER);
signals[GET_ICON_ACTIVATION_URI]
= g_signal_new ("get-icon-activation-uri",
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (NautilusCanvasContainerClass,
get_icon_activation_uri),
NULL, NULL,
g_cclosure_marshal_generic,
G_TYPE_STRING, 1,
G_TYPE_POINTER);
signals[GET_ICON_DROP_TARGET_URI]
= g_signal_new ("get-icon-drop-target-uri",
G_TYPE_FROM_CLASS (class),
......@@ -6963,6 +6974,20 @@ nautilus_canvas_container_get_icon_uri (NautilusCanvasContainer *container,
return uri;
}
char *
nautilus_canvas_container_get_icon_activation_uri (NautilusCanvasContainer *container,
NautilusCanvasIcon *icon)
{
char *uri;
uri = NULL;
g_signal_emit (container,
signals[GET_ICON_ACTIVATION_URI], 0,
icon->data,
&uri);
return uri;
}
char *
nautilus_canvas_container_get_icon_drop_target_uri (NautilusCanvasContainer *container,
NautilusCanvasIcon *icon)
......
......@@ -180,6 +180,8 @@ typedef struct {
NautilusCanvasPosition *position);
char * (* get_icon_uri) (NautilusCanvasContainer *container,
NautilusCanvasIconData *data);
char * (* get_icon_activation_uri) (NautilusCanvasContainer *container,
NautilusCanvasIconData *data);
char * (* get_icon_drop_target_uri) (NautilusCanvasContainer *container,
NautilusCanvasIconData *data);
......
......@@ -238,7 +238,7 @@ icon_get_data_binder (NautilusCanvasIcon *icon, gpointer data)
canvas_rect_world_to_widget (EEL_CANVAS (container), &world_rect, &widget_rect);
uri = nautilus_canvas_container_get_icon_uri (container, icon);
uri = nautilus_canvas_container_get_icon_activation_uri (container, icon);
if (uri == NULL) {
g_warning ("no URI for one of the iterated icons");
return TRUE;
......
......@@ -272,6 +272,8 @@ void nautilus_canvas_container_select_list_unselect_others (NautilusCan
GList *icons);
char * nautilus_canvas_container_get_icon_uri (NautilusCanvasContainer *container,
NautilusCanvasIcon *canvas);
char * nautilus_canvas_container_get_icon_activation_uri (NautilusCanvasContainer *container,
NautilusCanvasIcon *canvas);
char * nautilus_canvas_container_get_icon_drop_target_uri (NautilusCanvasContainer *container,
NautilusCanvasIcon *canvas);
void nautilus_canvas_container_update_icon (NautilusCanvasContainer *container,
......
......@@ -1698,6 +1698,18 @@ get_icon_uri_callback (NautilusCanvasContainer *container,
return nautilus_file_get_uri (file);
}
static char *
get_icon_activation_uri_callback (NautilusCanvasContainer *container,
NautilusFile *file,
NautilusCanvasView *canvas_view)
{
g_assert (NAUTILUS_IS_CANVAS_CONTAINER (container));
g_assert (NAUTILUS_IS_FILE (file));
g_assert (NAUTILUS_IS_CANVAS_VIEW (canvas_view));
return nautilus_file_get_activation_uri (file);
}
static char *
get_icon_drop_target_uri_callback (NautilusCanvasContainer *container,
NautilusFile *file,
......@@ -1930,6 +1942,8 @@ create_canvas_container (NautilusCanvasView *canvas_view)
/* FIXME: many of these should move into fm-canvas-container as virtual methods */
g_signal_connect_object (canvas_container, "get-icon-uri",
G_CALLBACK (get_icon_uri_callback), canvas_view, 0);
g_signal_connect_object (canvas_container, "get-icon-activation-uri",
G_CALLBACK (get_icon_activation_uri_callback), canvas_view, 0);
g_signal_connect_object (canvas_container, "get-icon-drop-target-uri",
G_CALLBACK (get_icon_drop_target_uri_callback), canvas_view, 0);
g_signal_connect_object (canvas_container, "move-copy-items",
......
......@@ -450,7 +450,7 @@ item_get_data_binder (GtkTreeModel *model,
column,
&cell_area);
uri = nautilus_file_get_uri (file);
uri = nautilus_file_get_activation_uri (file);
nautilus_file_unref (file);
/* pass the uri, mouse-relative x/y and icon width/height */
......
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