This is the mail archive of the
cygwin-apps
mailing list for the Cygwin project.
[PATCH setup 5/5] Limit the number of packages shown in the IDD_DOWNLOAD_ERROR listbox
- From: Ken Brown <kbrown at cornell dot edu>
- To: cygwin-apps at cygwin dot com
- Date: Fri, 10 Nov 2017 09:43:39 -0500
- Subject: [PATCH setup 5/5] Limit the number of packages shown in the IDD_DOWNLOAD_ERROR listbox
- Authentication-results: sourceware.org; auth=none
- References: <20171110144339.12616-1-kbrown@cornell.edu>
---
download.cc | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/download.cc b/download.cc
index b059bf5..6e6d6e8 100644
--- a/download.cc
+++ b/download.cc
@@ -188,6 +188,7 @@ download_one (packagesource & pkgsource, HWND owner)
static std::vector <packageversion> download_failures;
static std::string download_warn_pkgs;
+static const int max_pkgs = 20;
static INT_PTR CALLBACK
download_error_proc (HWND h, UINT message, WPARAM wParam, LPARAM lParam)
@@ -224,12 +225,19 @@ query_download_errors (HINSTANCE h, HWND owner)
{
download_warn_pkgs = "";
Log (LOG_PLAIN) << "The following package(s) had download errors:" << endLog;
+ int count = 0;
for (std::vector <packageversion>::const_iterator i = download_failures.begin (); i != download_failures.end (); i++)
{
packageversion pv = *i;
std::string pvs = pv.Name () + "-" + pv.Canonical_version ();
Log (LOG_PLAIN) << " " << pvs << endLog;
- download_warn_pkgs += pvs + "\r\n";
+ if (count < max_pkgs)
+ download_warn_pkgs += pvs + "\r\n";
+ else if (count == max_pkgs)
+ download_warn_pkgs += "...and "
+ + std::to_string (download_failures.size () - max_pkgs)
+ + " more.";
+ count++;
}
return DialogBox (h, MAKEINTRESOURCE (IDD_DOWNLOAD_ERROR), owner,
download_error_proc);
--
2.15.0