public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
From: Ken Brown <kbrown@cornell.edu>
To: cygwin-apps@cygwin.com
Subject: [PATCH setup 5/5] Limit the number of packages shown in the IDD_DOWNLOAD_ERROR listbox
Date: Fri, 10 Nov 2017 14:43:00 -0000	[thread overview]
Message-ID: <20171110144339.12616-6-kbrown@cornell.edu> (raw)
In-Reply-To: <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

  parent reply	other threads:[~2017-11-10 14:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-10 14:43 [PATCH setup 0/5] Improve behavior after download error, v2 Ken Brown
2017-11-10 14:43 ` [PATCH setup 2/5] Fix off-by-one error in download retry report Ken Brown
2017-11-10 14:43 ` [PATCH setup 1/5] Just retry download after error in unattended mode Ken Brown
2017-11-10 14:43 ` Ken Brown [this message]
2017-11-10 14:43 ` [PATCH setup 4/5] Query user after download error in interactive mode Ken Brown
2017-11-10 14:43 ` [PATCH setup 3/5] Remove "Try again?" from exit message Ken Brown
2017-11-13 11:51 ` [PATCH setup 0/5] Improve behavior after download error, v2 Jon Turney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171110144339.12616-6-kbrown@cornell.edu \
    --to=kbrown@cornell.edu \
    --cc=cygwin-apps@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).