commit 24b775fd2fbb2cbbd21a1d1e1b960bb813be31f9
parent efa63eb445cb3f71e8d10ba0c47f32fe9ef6aad0
Author: cfillion <cfillion@users.noreply.github.com>
Date: Sun, 22 May 2016 22:43:29 -0400
avoid reloading indexes unless they were updated by the transaction
Diffstat:
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/browser.hpp b/src/browser.hpp
@@ -44,6 +44,7 @@ class Browser : public Dialog {
public:
Browser(ReaPack *);
void refresh(bool stale = false);
+ void populate();
protected:
void onInit() override;
@@ -98,7 +99,6 @@ private:
Entry makeEntry(const Package *, const Registry::Entry &) const;
- void populate();
void transferActions();
bool match(const Entry &) const;
void checkFilter();
diff --git a/src/reapack.cpp b/src/reapack.cpp
@@ -506,11 +506,17 @@ Transaction *ReaPack::setupTransaction()
});
m_tx->setCleanupHandler([=] {
+ // refresh only once all onFinish slots were ran
+ if(m_browser) {
+ // don't reload indexes unless they were modified
+ if(m_tx->updatedIndexes())
+ m_browser->refresh();
+ else
+ m_browser->populate();
+ }
+
delete m_tx;
m_tx = nullptr;
-
- // refresh only once all onFinish slots were ran
- refreshBrowser();
});
return m_tx;
diff --git a/src/transaction.hpp b/src/transaction.hpp
@@ -61,6 +61,7 @@ public:
bool isCancelled() const { return m_isCancelled; }
const Receipt &receipt() const { return m_receipt; }
size_t taskCount() const { return m_tasks.size(); }
+ bool updatedIndexes() const { return !m_remotes.empty(); }
DownloadQueue *downloadQueue() { return &m_downloadQueue; }