Downloads are most of the time rather fast, having the window just pop
up and go away feels a bit irritating.
}
void
+Dialog::clear_buttons()
+{
+ m_buttons.clear();
+ m_selected_button = 0;
+}
+
+void
Dialog::add_button(const std::string& text, const std::function<void ()>& callback, bool focus)
{
m_buttons.push_back({text, callback});
virtual ~Dialog();
void set_text(const std::string& text);
+ void clear_buttons();
void add_button(const std::string& text, const std::function<void ()>& callback = {},
bool focus = false);
{
TransferStatusPtr status = m_addon_manager.request_check_online();
status->then([this]{
- MenuManager::instance().set_dialog({});
refresh();
});
std::unique_ptr<DownloadDialog> dialog(new DownloadDialog(status));
{
log_warning << "Enabling addon failed: " << err.what() << std::endl;
}
- MenuManager::instance().set_dialog({});
refresh();
});
});
update_text();
+
+ status->then([this]{
+ on_download_complete();
+ });
}
void
AddonManager::current()->abort_install();
}
+void
+DownloadDialog::on_download_complete()
+{
+ clear_buttons();
+ add_button(_("Close"), [this]{
+ MenuManager::instance().set_dialog({});
+ });
+}
+
/* EOF */
private:
void on_abort();
+ void on_download_complete();
void update_text();