From 86a74b4a93ab62c8ef7819dc549fe7b3ace24916 Mon Sep 17 00:00:00 2001 From: houz Date: Thu, 2 Jun 2016 15:12:07 +0200 Subject: Sort color profile lists Fixed bugs: - https://launchpad.net/bugs/1457126 (bzr r14946) --- src/ui/widget/color-icc-selector.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/ui/widget') diff --git a/src/ui/widget/color-icc-selector.cpp b/src/ui/widget/color-icc-selector.cpp index 2e30a48b5..b422892fe 100644 --- a/src/ui/widget/color-icc-selector.cpp +++ b/src/ui/widget/color-icc-selector.cpp @@ -671,6 +671,20 @@ void ColorICCSelectorImpl::_switchToProfile(gchar const *name) #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +struct _cmp { + bool operator()(const SPObject * const & a, const SPObject * const & b) + { + const Inkscape::ColorProfile &a_prof = reinterpret_cast(*a); + const Inkscape::ColorProfile &b_prof = reinterpret_cast(*b); + gchar *a_name_casefold = g_utf8_casefold(a_prof.name, -1 ); + gchar *b_name_casefold = g_utf8_casefold(b_prof.name, -1 ); + int result = g_strcmp0(a_name_casefold, b_name_casefold); + g_free(a_name_casefold); + g_free(b_name_casefold); + return result < 0; + } +}; + void ColorICCSelectorImpl::_profilesChanged(std::string const &name) { GtkComboBox *combo = GTK_COMBO_BOX(_profileSel); @@ -688,7 +702,8 @@ void ColorICCSelectorImpl::_profilesChanged(std::string const &name) int index = 1; std::vector current = SP_ACTIVE_DOCUMENT->getResourceList("iccprofile"); - for (std::vector::const_iterator it = current.begin(); it != current.end(); ++it) { + std::set _current(current.begin(), current.end()); + for (std::set::const_iterator it = _current.begin(); it != _current.end(); ++it) { SPObject *obj = *it; Inkscape::ColorProfile *prof = reinterpret_cast(obj); -- cgit v1.2.3