summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-12-18 22:17:36 +0000
committerCarl Hetherington <cth@carlh.net>2018-12-18 22:17:36 +0000
commit8ae2dcecc765df1a98a5dc686473ac46f5e08c3e (patch)
tree0185585ded7de77f775a8289697fa4a838c1c995
parent6b32680c18988808e56b053979816e53190c0568 (diff)
swaroop: alphabetically sort playlists.
-rw-r--r--src/wx/swaroop_controls.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/wx/swaroop_controls.cc b/src/wx/swaroop_controls.cc
index 5e386ae9b..176efc443 100644
--- a/src/wx/swaroop_controls.cc
+++ b/src/wx/swaroop_controls.cc
@@ -34,6 +34,7 @@
using std::string;
using std::cout;
using std::exception;
+using std::sort;
using boost::shared_ptr;
using boost::dynamic_pointer_cast;
using boost::optional;
@@ -271,6 +272,13 @@ SwaroopControls::add_playlist_to_list (SPL spl)
_spl_view->InsertItem (it);
}
+struct SPLComparator
+{
+ bool operator() (SPL const & a, SPL const & b) {
+ return a.name() < b.name();
+ }
+};
+
void
SwaroopControls::update_playlist_directory ()
{
@@ -290,12 +298,18 @@ SwaroopControls::update_playlist_directory ()
SPL spl;
spl.read (i->path(), _content_view);
_playlists.push_back (spl);
- add_playlist_to_list (spl);
}
} catch (exception& e) {
/* Never mind */
}
}
+
+ sort (_playlists.begin(), _playlists.end(), SPLComparator());
+ for (SPL i: _playlists) {
+ add_playlist_to_list (i);
+ }
+
+ _selected_playlist = boost::none;
}
void