public inbox for cygwin-apps-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jon TURNEY <jturney@sourceware.org>
To: cygwin-apps-cvs@sourceware.org
Subject: [setup - the official Cygwin setup program] branch master, updated. release_2.917
Date: Mon, 24 Jan 2022 17:58:17 +0000 (GMT)	[thread overview]
Message-ID: <20220124175817.9A1B43858C60@sourceware.org> (raw)




https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=6c940f562bece60e42aebe652d49c4023dfbd3cf

commit 6c940f562bece60e42aebe652d49c4023dfbd3cf
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Mon Jan 24 17:07:15 2022 +0000

    Don't create install package if there's no install: line
    
    Don't erroneously create an install package if there's no install: line
    for that version.
    
    If it's for the latest version and something depends on this package,
    the solver will produce a solution containing that package & version,
    so we'll try to download it without having a path to fetch it from,
    leading to download errors which are impossible to resolve.

https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=71046cdd73cbcce2e2713d188c10d4b573c5dddf

commit 71046cdd73cbcce2e2713d188c10d4b573c5dddf
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Mon Jan 24 16:28:29 2022 +0000

    Use SHMessageBoxCheck() for MessageBox with "don't show again" checkbox


Diff:
---
 IniDBBuilderPackage.cc |  4 ++++
 main.cc                |  4 ++--
 msg.cc                 | 20 +++++++++++++++++---
 msg.h                  |  1 +
 4 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/IniDBBuilderPackage.cc b/IniDBBuilderPackage.cc
index 96517e9b..3a8f10f8 100644
--- a/IniDBBuilderPackage.cc
+++ b/IniDBBuilderPackage.cc
@@ -376,6 +376,10 @@ IniDBBuilderPackage::process ()
   if (cbpv.version.empty())
     return;
 
+  // no install: line, no package
+  if (!cbpv.archive.Canonical())
+    return;
+
 #if DEBUG
   Log (LOG_BABBLE) << "Finished with package " << name << endLog;
   Log (LOG_BABBLE) << "Version " << cbpv.version << endLog;
diff --git a/main.cc b/main.cc
index ea4152f5..a48ee423 100644
--- a/main.cc
+++ b/main.cc
@@ -348,10 +348,10 @@ WinMain (HINSTANCE h,
           (!is_64bit)
 #endif
           mbox (NULL, IDS_DEPRECATED_WINDOWS_ARCH,
-                MB_ICONEXCLAMATION | MB_OK);
+                MB_ICONEXCLAMATION | MB_OK | MB_DSA_CHECKBOX);
         else if ((OSMajorVersion () == 6) && (OSMinorVersion() < 1))
           mbox (NULL, IDS_DEPRECATED_WINDOWS_VERSION,
-                MB_ICONEXCLAMATION | MB_OK);
+                MB_ICONEXCLAMATION | MB_OK | MB_DSA_CHECKBOX);
       }
 
     /* Set default DACL and Group. */
diff --git a/msg.cc b/msg.cc
index 00eaf5aa..39d87ebe 100644
--- a/msg.cc
+++ b/msg.cc
@@ -20,6 +20,7 @@
 
 #include "LogFile.h"
 #include "win32.h"
+#include <shlwapi.h>
 
 #include <stdio.h>
 #include <stdarg.h>
@@ -32,8 +33,6 @@ static int
 unattended_result(int mb_type)
 {
   // Return some default values.
-  Log (LOG_PLAIN) << "unattended_mode is set at mbox: returning default value" << endLog;
-
   switch (mb_type & MB_TYPEMASK)
     {
     case MB_OK:
@@ -62,7 +61,10 @@ mbox (HWND owner, const char *buf, const char *name, int type)
   // 'name' is not the mbox caption, just some text written to the log
   Log (LOG_PLAIN) << "mbox " << name << ": " << buf << endLog;
   if (unattended_mode)
+    {
+      Log (LOG_PLAIN) << "unattended_mode is set at mbox: returning default value" << endLog;
       return unattended_result(type);
+    }
 
   char caption[32];
   LoadString (hinstance, IDS_MBOX_CAPTION, caption, sizeof (caption));
@@ -126,6 +128,9 @@ LRESULT CALLBACK CBTProc(int nCode, WPARAM wParam, LPARAM lParam) {
   return CallNextHookEx(hMsgBoxHook, nCode, wParam, lParam);
 }
 
+// registry key to store "don't show this again" state, made unique by including a GUID
+static const char *regkey = "Cygwin-Setup-d975d7b8-8c44-44a1-915a-7cf44b79cd88";
+
 int
 mbox(HWND owner, unsigned int format_id, int mb_type, ...)
 {
@@ -163,7 +168,16 @@ mbox(HWND owner, unsigned int format_id, int mb_type, ...)
   }
 
   std::wstring caption = LoadStringW(IDS_MBOX_CAPTION);
-  int retval = MessageBoxW(owner, buf.c_str(), caption.c_str(), mb_type);
+  int retval;
+  if (mb_type & MB_DSA_CHECKBOX)
+    {
+      mb_type &= ~MB_DSA_CHECKBOX;
+      std::wstring regkey_msg = format(L"%s-%d", regkey, format_id);
+      retval = SHMessageBoxCheckW(owner, buf.c_str(), caption.c_str(), mb_type,
+                                  unattended_result(mb_type), regkey_msg.c_str());
+    }
+  else
+    retval = MessageBoxW(owner, buf.c_str(), caption.c_str(), mb_type);
 
   // When the the retry_continue customization is active, adjust the return
   // value for less confusing results
diff --git a/msg.h b/msg.h
index 98dff693..5f5d6578 100644
--- a/msg.h
+++ b/msg.h
@@ -38,5 +38,6 @@ int mbox (HWND owner, const char *buf, const char *name, int type);
 int mbox(HWND owner, unsigned int format_id, int mb_type, ...);
 
 #define MB_RETRYCONTINUE 7
+#define MB_DSA_CHECKBOX 0x80000000 // with a "Dont Show Me This Dialog Again" checkbox
 
 #endif /* SETUP_MSG_H */



             reply	other threads:[~2022-01-24 17:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-24 17:58 Jon TURNEY [this message]
2022-01-24 19:23 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=20220124175817.9A1B43858C60@sourceware.org \
    --to=jturney@sourceware.org \
    --cc=cygwin-apps-cvs@sourceware.org \
    /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).