mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 06:00:22 +00:00
testlist3: Handle dropping a row onto itself
Instead of spewing criticals, we should handle this gracefully by doing nothing.
This commit is contained in:
parent
72d13535b7
commit
d0f36a1793
@ -70,6 +70,9 @@ drag_data_received (GtkWidget *widget,
|
|||||||
row = (gpointer)* (gpointer*)gtk_selection_data_get_data (selection_data);
|
row = (gpointer)* (gpointer*)gtk_selection_data_get_data (selection_data);
|
||||||
source = gtk_widget_get_ancestor (row, GTK_TYPE_LIST_BOX_ROW);
|
source = gtk_widget_get_ancestor (row, GTK_TYPE_LIST_BOX_ROW);
|
||||||
|
|
||||||
|
if (source == target)
|
||||||
|
return;
|
||||||
|
|
||||||
g_object_ref (source);
|
g_object_ref (source);
|
||||||
gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (source)), source);
|
gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (source)), source);
|
||||||
gtk_list_box_insert (GTK_LIST_BOX (gtk_widget_get_parent (target)), source, pos);
|
gtk_list_box_insert (GTK_LIST_BOX (gtk_widget_get_parent (target)), source, pos);
|
||||||
|
Loading…
Reference in New Issue
Block a user