aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mods.cc17
1 files changed, 12 insertions, 5 deletions
diff --git a/mods.cc b/mods.cc
index 99985b6..405b316 100644
--- a/mods.cc
+++ b/mods.cc
@@ -5,6 +5,7 @@
#include <thread>
#include <sys/types.h>
#include <sys/stat.h>
+#include <algorithm>
// We want: https://developer.gnome.org/gtkmm-tutorial/stable/sec-multithread-example.html.en
void Mods::update(unsigned long totalBytes, unsigned long completedBytes, std::string mess)
@@ -157,13 +158,19 @@ void Mods::displayDownload() {
sw->add(*langBox);
sw->set_propagate_natural_width(true);
sw->set_min_content_height(300);
- for(auto item : modsAvailable) {
- string language = item.first;
- auto *langButton = Gtk::manage(new Gtk::Button(language));
+ auto langAbbrevsToFull = libbible::getLanguageNames();
+ std::map<std::string, std::string> langFullToAbbrevs;
+ for(const auto& [abbrev, full] : langAbbrevsToFull) langFullToAbbrevs.emplace(full, abbrev);
+ std::vector<std::string> langsSorted;
+ for(auto const& pair : modsAvailable) langsSorted.push_back(langAbbrevsToFull[pair.first]);
+ std::sort(langsSorted.begin(), langsSorted.end());
+ for(string fullLanguage : langsSorted) {
+ string language = langFullToAbbrevs[fullLanguage];
+ auto *langButton = Gtk::manage(new Gtk::Button(fullLanguage));
langButton->set_relief(Gtk::ReliefStyle::RELIEF_NONE);
- langButton->signal_clicked().connect([language, langMenuButton, langMenu, modsSelection, this]() {
+ langButton->signal_clicked().connect([language, fullLanguage, langMenuButton, langMenu, modsSelection, this]() {
langMenu->popdown();
- langMenuButton->set_label(language);
+ langMenuButton->set_label(fullLanguage);
for(auto child : modsSelection->get_children()) {
modsSelection->remove(*child);
}