After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 94742 - Make const TreeSelection more useful.
Make const TreeSelection more useful.
Status: RESOLVED FIXED
Product: gtkmm
Classification: Bindings
Component: TreeView
2.4
Other All
: Normal enhancement
: 3
Assigned To: gtkmm-forge
gtkmm-forge
: 379231 (view as bug list)
Depends on: 134520
Blocks:
 
 
Reported: 2002-10-03 06:04 UTC by Matthew Tuck
Modified: 2017-01-05 17:26 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement



Description Matthew Tuck 2002-10-03 06:04:45 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.
Comment 1 Murray Cumming 2002-10-03 07:10:10 UTC
Any chance of a patch?
Comment 2 Murray Cumming 2002-10-31 12:18:02 UTC
Too late. Punted.
Comment 3 Murray Cumming 2003-03-14 15:22:50 UTC
A patch would be really nice.
Comment 4 Murray Cumming 2004-02-29 17:56:37 UTC
> 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.
Comment 5 Murray Cumming 2007-02-10 15:22:48 UTC
*** Bug 379231 has been marked as a duplicate of this bug. ***
Comment 6 Kjell Ahlstedt 2017-01-05 17:26:19 UTC
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