placessidebar: Fix the bookmark drag icon

Just use the widget; a paintable only works if the
widget it is based on actually gets drawn, the
clone we create here wasn't.
This commit is contained in:
Matthias Clasen 2020-08-08 14:24:45 -04:00
parent 4eaf08e964
commit e18de295c6

View File

@ -61,7 +61,6 @@
#include "gtknative.h"
#include "gtkdragsource.h"
#include "gtkdragicon.h"
#include "gtkwidgetpaintable.h"
#include "gtkstylecontext.h"
/*< private >
@ -3475,7 +3474,6 @@ on_row_dragged (GtkGestureDrag *gesture,
GdkDevice *device;
GtkAllocation allocation;
GtkWidget *drag_widget;
GdkPaintable *paintable;
GdkDrag *drag;
gtk_gesture_drag_get_start_point (gesture, &start_x, &start_y);
@ -3501,17 +3499,11 @@ on_row_dragged (GtkGestureDrag *gesture,
gtk_widget_hide (sidebar->drag_row);
drag_widget = GTK_WIDGET (gtk_sidebar_row_clone (GTK_SIDEBAR_ROW (sidebar->drag_row)));
g_object_ref_sink (drag_widget);
sidebar->drag_row_height = allocation.height;
gtk_widget_set_size_request (drag_widget, allocation.width, allocation.height);
gtk_widget_set_opacity (drag_widget, 0.8);
paintable = gtk_widget_paintable_new (drag_widget);
gtk_drag_icon_set_from_paintable (drag, paintable, sidebar->drag_row_x, sidebar->drag_row_y);
g_object_unref (paintable);
g_object_set_data_full (G_OBJECT (drag), "row-widget", drag_widget, (GDestroyNotify)g_object_unref);
gtk_drag_icon_set_child (GTK_DRAG_ICON (gtk_drag_icon_get_for_drag (drag)), drag_widget);
g_object_unref (drag);
}