=== modified file 'src/color-profile.cpp' --- src/color-profile.cpp 2015-02-25 00:22:08 +0000 +++ src/color-profile.cpp 2015-07-01 10:39:32 +0000 @@ -766,6 +766,10 @@ } #endif // WIN32 + std::sort(sources.begin(), sources.end()); + std::vector::iterator last = std::unique(sources.begin(), sources.end()); + sources.erase(last, sources.end()); + return sources; } @@ -845,9 +849,18 @@ } } + std::sort(files.begin(), files.end()); + std::vector::iterator last = std::unique(files.begin(), files.end()); + files.erase(last, files.end()); + return files; } +bool compareProfilePairByName(const std::pair & a, const std::pair & b) +{ + return a.second < b.second; +} + std::vector > ColorProfile::getProfileFilesWithNames() { std::vector > result; @@ -862,7 +875,9 @@ cmsCloseProfile(hProfile); } } - std::sort(result.begin(), result.end()); + + std::sort(result.begin(), result.end(), compareProfilePairByName); + #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) return result; === modified file 'src/ui/dialog/document-properties.cpp' --- src/ui/dialog/document-properties.cpp 2015-05-08 13:46:25 +0000 +++ src/ui/dialog/document-properties.cpp 2015-07-01 10:44:10 +0000 @@ -508,6 +508,15 @@ } } +static gint _cmp(gconstpointer a, gconstpointer b) +{ + SPObject *a_obj = SP_OBJECT(a); + SPObject *b_obj = SP_OBJECT(b); + Inkscape::ColorProfile *a_prof = reinterpret_cast(a_obj); + Inkscape::ColorProfile *b_prof = reinterpret_cast(b_obj); + return g_strcmp0(a_prof->name, b_prof->name); +} + void DocumentProperties::populate_linked_profiles_box() { _LinkedProfilesListStore->clear(); @@ -515,14 +524,17 @@ if (current) { _emb_profiles_observer.set(SP_OBJECT(current->data)->parent); } - while ( current ) { - SPObject* obj = SP_OBJECT(current->data); + GSList *tmp = g_slist_sort(g_slist_copy((GSList *)current), _cmp); + GSList *head = tmp; + while ( tmp ) { + SPObject* obj = SP_OBJECT(tmp->data); Inkscape::ColorProfile* prof = reinterpret_cast(obj); Gtk::TreeModel::Row row = *(_LinkedProfilesListStore->append()); row[_LinkedProfilesListColumns.nameColumn] = prof->name; // row[_LinkedProfilesListColumns.previewColumn] = "Color Preview"; - current = g_slist_next(current); + tmp = g_slist_next(tmp); } + g_slist_free(head); } void DocumentProperties::external_scripts_list_button_release(GdkEventButton* event) === modified file 'src/ui/widget/color-icc-selector.cpp' --- src/ui/widget/color-icc-selector.cpp 2015-05-17 11:43:24 +0000 +++ src/ui/widget/color-icc-selector.cpp 2015-07-01 10:25:39 +0000 @@ -660,6 +660,15 @@ #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +static gint _cmp(gconstpointer a, gconstpointer b) +{ + SPObject *a_obj = SP_OBJECT(a); + SPObject *b_obj = SP_OBJECT(b); + Inkscape::ColorProfile *a_prof = reinterpret_cast(a_obj); + Inkscape::ColorProfile *b_prof = reinterpret_cast(b_obj); + return g_strcmp0(a_prof->name, b_prof->name); +} + void ColorICCSelectorImpl::_profilesChanged(std::string const &name) { GtkComboBox *combo = GTK_COMBO_BOX(_profileSel); @@ -677,8 +686,10 @@ int index = 1; const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList("iccprofile"); - while (current) { - SPObject *obj = SP_OBJECT(current->data); + GSList *tmp = g_slist_sort(g_slist_copy((GSList *)current), _cmp); + GSList *head = tmp; + while (tmp) { + SPObject *obj = SP_OBJECT(tmp->data); Inkscape::ColorProfile *prof = reinterpret_cast(obj); gtk_list_store_append(store, &iter); @@ -690,8 +701,9 @@ } index++; - current = g_slist_next(current); + tmp = g_slist_next(tmp); } + g_slist_free(head); g_signal_handler_unblock(G_OBJECT(_profileSel), _profChangedID); }