summaryrefslogtreecommitdiffstats
path: root/src/ui/widget
diff options
context:
space:
mode:
authorMartin Owens <doctormo@gmail.com>2017-07-05 14:11:31 +0000
committerMartin Owens <doctormo@gmail.com>2017-07-05 14:11:31 +0000
commit23b717b1fbb4e25d424a08d2f663143be0e72a09 (patch)
tree4f20d1191e9911947c7106d37477f5e819ff870c /src/ui/widget
parentFix 'direction' gui. (diff)
parentUse std::transform instead of a for loop (diff)
downloadinkscape-23b717b1fbb4e25d424a08d2f663143be0e72a09.tar.gz
inkscape-23b717b1fbb4e25d424a08d2f663143be0e72a09.zip
Merge branch 'houz/inkscape-color-profiles-cleanup'
Diffstat (limited to 'src/ui/widget')
-rw-r--r--src/ui/widget/color-icc-selector.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/ui/widget/color-icc-selector.cpp b/src/ui/widget/color-icc-selector.cpp
index 616e9afa8..f1dd92746 100644
--- a/src/ui/widget/color-icc-selector.cpp
+++ b/src/ui/widget/color-icc-selector.cpp
@@ -663,6 +663,9 @@ struct _cmp {
}
};
+template <typename From, typename To>
+struct static_caster { To * operator () (From * value) const { return static_cast<To *>(value); } };
+
void ColorICCSelectorImpl::_profilesChanged(std::string const &name)
{
GtkComboBox *combo = GTK_COMBO_BOX(_profileSel);
@@ -680,10 +683,15 @@ void ColorICCSelectorImpl::_profilesChanged(std::string const &name)
int index = 1;
std::vector<SPObject *> current = SP_ACTIVE_DOCUMENT->getResourceList("iccprofile");
- std::set<SPObject *, _cmp> _current(current.begin(), current.end());
- for (std::set<SPObject *, _cmp>::const_iterator it = _current.begin(); it != _current.end(); ++it) {
- SPObject *obj = *it;
- Inkscape::ColorProfile *prof = reinterpret_cast<Inkscape::ColorProfile *>(obj);
+
+ std::set<Inkscape::ColorProfile *, Inkscape::ColorProfile::pointerComparator> _current;
+ std::transform(current.begin(),
+ current.end(),
+ std::inserter(_current, _current.begin()),
+ static_caster<SPObject, Inkscape::ColorProfile>());
+
+ for (auto &it: _current) {
+ Inkscape::ColorProfile *prof = it;
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter, 0, gr_ellipsize_text(prof->name, 25).c_str(), 1, prof->name, -1);