diff options
Diffstat (limited to 'sword.cc')
-rw-r--r-- | sword.cc | 24 |
1 files changed, 16 insertions, 8 deletions
@@ -10,11 +10,18 @@ bool isNoMods; Sword::Sword() { auto mods = libbible::getModules(); isNoMods = mods.empty(); - defaultMod = libbible::settingsRead("module"); - if(mods.find(defaultMod) == mods.end()) { - defaultMod = string(); + string defaultMod = libbible::settingsRead("module"); + currMod = libbible::settingsRead("biblereader::currMod"); + if(mods.find(currMod) == mods.end()) { + currMod = defaultMod; + } + if(mods.find(currMod) == mods.end()) { + currMod = string(); if(! mods.empty()) { + // New default mod (previous was deleted) defaultMod = mods.begin()->first; + libbible::settingsWrite("module", defaultMod); + currMod = defaultMod; } } } @@ -31,7 +38,8 @@ vector<string> Sword::getModules() { } void Sword::setModule(string version) { - defaultMod = version; + currMod = version; + libbible::settingsWrite("biblereader::currMod", currMod); } void Sword::fillBuffer(string ref, Glib::RefPtr<Gtk::TextBuffer> buf) { @@ -46,7 +54,7 @@ void Sword::fillBuffer(string ref, Glib::RefPtr<Gtk::TextBuffer> buf) { return; } - auto texts = libbible::getText(libbible::getPassage(defaultMod, ref)); + auto texts = libbible::getText(libbible::getPassage(currMod, ref)); auto iter = buf->get_iter_at_offset(0); @@ -128,12 +136,12 @@ void Sword::getConfig(string book, int chapter, struct config *conf) { conf->maxChapter = 0; conf->version = ""; } else { - auto passages = libbible::getPassages(defaultMod, book); + auto passages = libbible::getPassages(currMod, book); conf->chapter = chapter; conf->book = passages[0].bookShort; conf->bookFull = passages[0].book; conf->maxChapter = passages.back().chapterStart; - conf->version = defaultMod; + conf->version = currMod; } } @@ -141,5 +149,5 @@ vector<string> Sword::getBooks() { if(isNoMods) { return vector<string>(); } - return libbible::getModules()[defaultMod]; + return libbible::getModules()[currMod]; } |