I am trying to migrate some gtk3 → gtk4 code regarding Gtk::ListStore and the new Gio::ListStore.
The task of the class is to fetch memory/allocation data and show it in a TreeView in Inkscpape.
I’ve started to refactor it into purely gtk4 code (TreeView → ListView, TreeView.model → ListView.factory, …)
The code has a function update which gets state and updates all rows. Currently this is done using an Gtk::ListStore::iterator, but Gio::ListStore doesn’t have this property (as it’s only data). I have doubts on how to use this class. Do I need a separate model for the UI?
Another problem is that I have included giomm/liststore.h, however I can’t use Gio::ListStore. IDE recommends GListStore, but marks it as an incomplete type afterwards.
It’s true that Gio::ListStore doesn’t have an iterator. But it has
Gio::ListModel::get_n_items() and Gio::ListStore<T_item>::get_item(position).
Items in a Gio::ListStore are reference counted. get_item() does not get a copy,
it gets a Glib::RefPtr to the item in the Gio::ListStore.
I have included giomm/liststore.h, however I can’t use Gio::ListStore.
How do you try to use it? Have you noticed that Gio::ListStore is a template class?