reapack

Package manager for REAPER
Log | Files | Refs | Submodules | README | LICENSE

commit 9b5257a9adceb89e1a39182bfdc0e899dca9b147
parent 407ca104f22eab873ccbae44225c1447564b93e8
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Mon, 27 Mar 2017 23:20:25 -0400

browser: don't reopen the browser by itself after a transaction (regression)

This behavior was removed in 9de3174e1660c8774902d31bad7109b001066434

Diffstat:
Msrc/browser.cpp | 21+++++++++++++--------
Msrc/browser.hpp | 5+++--
2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/src/browser.cpp b/src/browser.cpp @@ -53,7 +53,7 @@ enum Timers { TIMER_FILTER = 1, TIMER_ABOUT }; Browser::Browser(ReaPack *reapack) : Dialog(IDD_BROWSER_DIALOG), m_reapack(reapack), - m_loading(Idle), m_currentIndex(-1) + m_loadState(Init), m_currentIndex(-1) { } @@ -238,7 +238,7 @@ void Browser::onCommand(const int id, const int event) else break; case IDCANCEL: - if(m_loading) + if(m_loadState >= Loading) hide(); else close(); @@ -526,12 +526,12 @@ void Browser::refresh(const bool stale) { // Do nothing when called again when (or while) the index downloading // transaction finishes. populate() handles the next step of the loading process. - switch(m_loading) { + switch(m_loadState) { case Done: - m_loading = Idle; + m_loadState = Loaded; case Loading: return; - case Idle: + default: break; } @@ -552,12 +552,17 @@ void Browser::refresh(const bool stale) } if(Transaction *tx = m_reapack->setupTransaction()) { - m_loading = Loading; + const bool firstLoad = m_loadState == Init; + m_loadState = Loading; tx->fetchIndexes(remotes, stale); tx->onFinish([=] { - m_loading = Done; - populate(tx->getIndexes(remotes)); + m_loadState = Done; + + if(firstLoad || isVisible()) + populate(tx->getIndexes(remotes)); + else + close(); }); tx->runTasks(); diff --git a/src/browser.hpp b/src/browser.hpp @@ -102,7 +102,8 @@ private: }; enum LoadState { - Idle, + Init, + Loaded, Loading, Done, }; @@ -147,7 +148,7 @@ private: void aboutPackage(int index, bool focus = true); ReaPack *m_reapack; - LoadState m_loading; + LoadState m_loadState; int m_currentIndex; Filter m_filter;