Skip to content

preGTK4: Replace TreeIter with TreeModel::iterator

Daniel Boles requested to merge dboles/inkscape:djb_TreeIter_preGTK4 into master

gtkmm4 adds ConstRow and makes TreeIter a template on either Row or ConstRow, instead of TreeIter being a non-template that's always writeable. So we can't just use TreeIter without template argument in gtkmm4: we just get lots of syntax errors. But we DO already have in gtkmm3, TreeMode::[const_]iterator, to which TreeIter<[Const]Row> are typedefs. So we can start using the forward-compatible syntax already.

gtkmm4 goes to lengths to be a lots more const-correct: const_iterator is now different from iterator and prevents modifications through itself; ditto the ConstRow to which it dereferences. Also, even TreeModel::Row disallows modifications if the instance is const. So some tweaks may be needed in gtkmm4 to avoid that. But in general, since this stuff is all deprecated in GTK4 for removal in GTK5, I don't put effort into making us as const-correct as we could be, because it will just be lost when we replace all the TreeViews with GTK4 list widgets/models.

Well, OK, I do a little bit where it was easy enough to backport, but more complex fixes probably must wait until GTK4 (especially those that rely on Row.get_iter() to replace previous convertibility between those)

Merge request reports