commit 50087132341b99df88635cfd7b8a2f1f659b2a64
parent 82d894ea2baa6cab4820cc1f5656340ef2c0501c
Author: cfillion <cfillion@users.noreply.github.com>
Date: Mon, 5 Jun 2017 22:31:08 -0400
refresh the manager only when required
Diffstat:
6 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/api.cpp b/src/api.cpp
@@ -342,7 +342,7 @@ autoInstall: usually set to 2 (obey user setting).)",
}
if(commit)
- reapack->commit();
+ reapack->commitConfig();
return true;
});
diff --git a/src/import.cpp b/src/import.cpp
@@ -222,7 +222,7 @@ void Import::processQueue()
if(ok)
m_state = Close;
- m_reapack->commit();
+ m_reapack->commitConfig();
}
bool Import::import(const ImportData &data)
diff --git a/src/import.hpp b/src/import.hpp
@@ -20,7 +20,6 @@
#include "dialog.hpp"
-#include "encoding.hpp"
#include "remote.hpp"
#include <queue>
diff --git a/src/manager.cpp b/src/manager.cpp
@@ -692,8 +692,8 @@ bool Manager::apply()
if(syncAll)
m_reapack->synchronizeAll();
+ tx->onFinish(bind(&Config::write, m_config));
tx->runTasks();
- m_config->write();
reset();
return true;
diff --git a/src/reapack.cpp b/src/reapack.cpp
@@ -354,19 +354,20 @@ void ReaPack::teardownTransaction()
// Update the browser only after the transaction is deleted because
// it must be able to start a new one to load the indexes
refreshBrowser();
- refreshManager();
}
-void ReaPack::commit()
+void ReaPack::commitConfig()
{
- if(m_tx)
+ if(m_tx) {
+ m_tx->onFinish(bind(&ReaPack::refreshManager, this));
+ m_tx->onFinish(bind(&Config::write, m_config));
m_tx->runTasks();
+ }
else {
- refreshBrowser();
refreshManager();
+ refreshBrowser();
+ m_config->write();
}
-
- m_config->write();
}
void ReaPack::refreshManager()
diff --git a/src/reapack.hpp b/src/reapack.hpp
@@ -78,7 +78,7 @@ public:
Remote remote(const std::string &name) const;
Transaction *setupTransaction();
- void commit();
+ void commitConfig();
Config *config() const { return m_config; }
private: