New Gio.ListStore Drag & drop interface?

GtkListStore is a storage type, and never implemented drag and drop: that’s something provided by GtkTreeView.

There is no automatic “drag a row and drop it somewhere to re-order the contents of the model” API in GtkListView, because the widget recycles rows, and that makes it very complicated. You can implement dragging from a row in the list view, and dropping into the list view, as rows are widgets. See GtkDragSource and GtkDropTarget. Implementing re-ordering with scroll when reaching the edge of the list view is also possible, but will require a fair chunk of work.

From a usability perspective, “drag and drop to re-order rows” isn’t a great user experience. It’s not accessible, and requires a pointing device at all times. You should look into possible substitutes for this interaction.

1 Like