A ListView with a header and footer


I like the GtkListView widget’s ability to create performant lists. However, there is one functionality I haven’t been able to implement with the current API: headers and footers.

To get the performance benefits of a GtkListView, it’s necessary to put the widget directly inside a GtkScrolledWindow; otherwise, it won’t act as a recycler view. However, there is an issue: what if you want to show content above and below the view items?

This functionality is most used for “playlist view”. For example, in GNOME Music, Spot and Muzika. The basic functionality is a list view with a header (not to be confused with a section header) that includes playlist details such as name, creator, etc… and optionally a footer that may contain other supplementary information such as related playlists or suggested tracks to add to a playlist.

Spot has a custom implementation that adds a global header while keeping the performance benefits of the ListView widget. Still, as that app requires a paid Spotify subscription, which I currently don’t have, I’ve been unable to test it.

It would then be nice to know if there is a way one can work around that limitation or if a specific helper widget can be made to help with this use case.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.