GNOME Bugzilla – Bug 94742
Make const TreeSelection more useful.
Last modified: 2017-01-05 17:26:19 UTC
When I have a const TreeView *, and do a get_selection(), I get a const TreeSelection OK, but it's not very useful. In particular, there is no get_selected() for const TreeSelection, nor selected_foreach. This restricts what you can do with a const TreeView. I'm not sure if the idea of a const TreeIter is fully supported (it seems to be, but in particular I see that TreeRow::set_value is a const-this method), but it probably needs to be to do this.
Any chance of a patch?
Too late. Punted.
A patch would be really nice.
> In particular, there is no get_selected() for const TreeSelection, This needs a TreeModel::const_iterator - see bug #134520. I have made that bug as a dependency. >nor selected_foreach(). This restricts what you can do with a const TreeView. Yes, I have made selected_foreach() const in gtkmm 2.4, because the documentation says that the callback should not change the model or treeview. But it should really use a const_iterator to enforce this - I added a TODO about that.
*** Bug 379231 has been marked as a duplicate of this bug. ***
At last, after more than 14 years, there is a real TreeModel::const_iterator in git's master branch, which will become gtkmm4. I have added const versions of TreeSelection::get_selected(). https://git.gnome.org/browse/gtkmm/commit/?id=afb8f05f7bb52848bee624db780c28c53af65a75