summaryrefslogtreecommitdiff
path: root/plugingui/listboxbasic.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2013-05-02 09:22:02 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2013-05-02 09:22:02 +0200
commitb0ac993673b50860b8215d0dc9ce0a0ae4b899ff (patch)
tree20dbef00a2144fbb2d44c8070148c83af0f2438c /plugingui/listboxbasic.cc
parent763a14223fdabd8060603d858138a3ba33a7a8b6 (diff)
Fix list sorting.
Diffstat (limited to 'plugingui/listboxbasic.cc')
-rw-r--r--plugingui/listboxbasic.cc28
1 files changed, 9 insertions, 19 deletions
diff --git a/plugingui/listboxbasic.cc b/plugingui/listboxbasic.cc
index 03fd0c4..66c1ab5 100644
--- a/plugingui/listboxbasic.cc
+++ b/plugingui/listboxbasic.cc
@@ -92,25 +92,15 @@ void GUI::ListBoxBasic::addItems(std::vector<GUI::ListBoxBasic::Item> &is)
}
// sort
- if(items.size() == 2) {
- DEBUG(list, "Sorting special case with two items\n");
- if(items[0].name > items[1].name) {
- GUI::ListBoxBasic::Item tmp = items[0];
- items[0] = items[1];
- items[1] = tmp;
- }
- }
- else {
- for(int x = 0; x < (int)items.size() - 1; x++) {
- for(int y = 0; y < (int)items.size() - 1; y++) {
- if(items[x].name < items[y].name) {
- if(x == selected) setSelection(y);
- else if(selected == y) setSelection(x);
-
- GUI::ListBoxBasic::Item tmp = items[x];
- items[x] = items[y];
- items[y] = tmp;
- }
+ for(int x = 0; x < (int)items.size(); x++) {
+ for(int y = 0; y < (int)items.size(); y++) {
+ if(items[x].name < items[y].name) {
+ if(x == selected) setSelection(y);
+ else if(selected == y) setSelection(x);
+
+ GUI::ListBoxBasic::Item tmp = items[x];
+ items[x] = items[y];
+ items[y] = tmp;
}
}
}