commit c7cd8ae3d7e3b018871582671344ae1ea7af20cf
parent b52fe339de78c2ef71c133a758ca5fa6098d62be
Author: cfillion <cfillion@users.noreply.github.com>
Date: Wed, 20 Apr 2016 21:13:27 -0400
refresh the browser when toggling settings from the manager
Diffstat:
3 files changed, 27 insertions(+), 11 deletions(-)
diff --git a/src/manager.cpp b/src/manager.cpp
@@ -305,7 +305,11 @@ void Manager::apply()
m_reapack->uninstall(remote);
m_config->write();
- m_reapack->runTasks();
+
+ if(m_reapack->isRunning())
+ m_reapack->runTasks();
+ else
+ m_reapack->refreshBrowser();
}
void Manager::reset()
diff --git a/src/reapack.cpp b/src/reapack.cpp
@@ -159,13 +159,12 @@ void ReaPack::setRemoteEnabled(const Remote &original, const bool enable)
const auto apply = [=] {
m_config->remotes()->add(remote);
-
- if(m_manager)
- m_manager->refresh();
+ refreshManager();
};
if(!hitchhikeTransaction()) {
apply();
+ refreshBrowser();
return;
}
@@ -196,6 +195,7 @@ void ReaPack::uninstall(const Remote &remote)
if(!hitchhikeTransaction()) {
apply();
+ refreshBrowser();
return;
}
@@ -280,11 +280,8 @@ void ReaPack::import(const Remote &remote, HWND parent)
remotes->add(remote);
m_config->write();
- if(m_manager)
- m_manager->refresh();
-
- if(m_browser)
- m_browser->refresh();
+ refreshManager();
+ refreshBrowser();
const string msg = remote.name() +
" has been successfully imported into your repository list.";
@@ -529,8 +526,7 @@ Transaction *ReaPack::createTransaction()
m_transaction = nullptr;
// refresh only once all onFinish slots were ran
- if(m_browser)
- m_browser->refresh();
+ refreshBrowser();
});
return m_transaction;
@@ -550,6 +546,18 @@ void ReaPack::runTasks()
m_transaction->runTasks();
}
+void ReaPack::refreshManager()
+{
+ if(m_manager)
+ m_manager->refresh();
+}
+
+void ReaPack::refreshBrowser()
+{
+ if(m_browser)
+ m_browser->refresh();
+}
+
void ReaPack::registerSelf()
{
// hard-coding galore!
diff --git a/src/reapack.hpp b/src/reapack.hpp
@@ -69,6 +69,7 @@ public:
void install(const Version *);
void uninstall(const Remote &);
void uninstall(const Registry::Entry &);
+
void importRemote();
void import(const Remote &, HWND = nullptr);
void manageRemotes();
@@ -76,6 +77,9 @@ public:
void about(const std::string &, HWND parent);
void about(const Remote &, HWND parent);
void browsePackages();
+ void refreshManager();
+ void refreshBrowser();
+
void fetchIndex(const Remote &remote, const IndexCallback &,
HWND parent, bool stale = false);
void fetchIndexes(const std::vector<Remote> &,