diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index d7f9649e4..09bdb07de 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -1065,6 +1065,7 @@ void Preferences::parseDir (Glib::ustring dirname, std::vector& i if (!safe_file_test (fname, Glib::FILE_TEST_IS_DIR) && sname.size() >= ext.size() && sname.substr (sname.size()-ext.size(), ext.size()).casefold() == ext) items.push_back (sname.substr(0,sname.size()-ext.size())); } + std::sort(items.begin(), items.end()); delete dir; } diff --git a/rtgui/profilestore.cc b/rtgui/profilestore.cc index 6754182b5..733b3c0f0 100644 --- a/rtgui/profilestore.cc +++ b/rtgui/profilestore.cc @@ -113,6 +113,10 @@ void ProfileStore::_parseProfiles () { currDir = "${G}"; parseDir (p2, virtualPath, currDir, 0, 0, displayLevel0); } + + // sort profiles + std::sort(entries.begin(), entries.end(), SortProfiles() ); + // entries and partProfiles are empty, but the entry and profiles already exist (they have survived to clearFileList and clearProfileList) if (!internalDefaultEntry) internalDefaultEntry = new ProfileStoreEntry(Glib::ustring("(") + M("PROFILEPANEL_PINTERNAL") + Glib::ustring(")"), PSET_FILE, 0, 0); @@ -195,7 +199,7 @@ bool ProfileStore::parseDir (Glib::ustring& realPath, Glib::ustring& virtualPath // map the partial profile partProfiles[filePSE] = pProf; - //partProfiles.insert( std::pair (folderPSE, pProf) ); + //partProfiles.insert( std::pair (filePSE, pProf) ); } else if( options.rtSettings.verbose ) { printf ("failed!\n"); diff --git a/rtgui/profilestore.h b/rtgui/profilestore.h index 86c923209..bd9c019fb 100644 --- a/rtgui/profilestore.h +++ b/rtgui/profilestore.h @@ -125,6 +125,12 @@ class ProfileStore { } StoreState; private: + struct SortProfiles { + bool operator ()(const ProfileStoreEntry* const a1, const ProfileStoreEntry* const a2) { + return a1->parentFolderId == a2->parentFolderId ? a1->label < a2->label : a1->parentFolderId < a2->parentFolderId; + } + }; + MyMutex *parseMutex; StoreState storeState; rtengine::procparams::AutoPartialProfile *internalDefaultProfile;