placessidebar: Fix dnd cancellation

When the drag is canceled by being dropped outside,
we get a ::cancel emission, that we want to handle
just like ::dnd-finished.

Fixes: #3037
This commit is contained in:
Matthias Clasen 2020-08-08 14:25:46 -04:00
parent e18de295c6
commit dbbc9b5c58

View File

@ -1896,6 +1896,14 @@ dnd_finished_cb (GdkDrag *drag,
stop_drop_feedback (sidebar);
}
static void
dnd_cancel_cb (GdkDrag *drag,
GdkDragCancelReason reason,
GtkPlacesSidebar *sidebar)
{
stop_drop_feedback (sidebar);
}
/* This functions is called every time the drag source leaves
* the sidebar widget.
* The problem is that, we start showing hints for drop when the source
@ -3494,6 +3502,7 @@ on_row_dragged (GtkGestureDrag *gesture,
g_object_unref (content);
g_signal_connect (drag, "dnd-finished", G_CALLBACK (dnd_finished_cb), sidebar);
g_signal_connect (drag, "cancel", G_CALLBACK (dnd_cancel_cb), sidebar);
gtk_widget_get_allocation (sidebar->drag_row, &allocation);
gtk_widget_hide (sidebar->drag_row);