public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
From: Jon TURNEY <jon.turney@dronecode.org.uk>
To: cygwin-apps@cygwin.com
Subject: [PATCH] Don't show setup version warning message box in unattended mode
Date: Mon, 18 Nov 2013 16:49:00 -0000	[thread overview]
Message-ID: <528A44B3.4020706@dronecode.org.uk> (raw)

[-- Attachment #1: Type: text/plain, Size: 535 bytes --]


As was pointed out on IRC a week or two ago, setup can show a "The current ini
file is from a newer version of setup..." message box even in unattended mode.

Attached is a patch to fix.

There are other uses of MessageBox() which probably present a similar problem
and still need fixing.

2013-11-18  Jon TURNEY  <jon.turney@dronecode.org.uk>

	* msg.cc (mbox): Generalize to a MessgeBox() wrapper which knows
	what to do in unattended mode.
	* msg.h: Add prototype.
	* ini.cc (IniParseFeedback): Use here rather than MessageBox().


[-- Attachment #2: unattended.patch --]
[-- Type: text/plain, Size: 2434 bytes --]

Index: ini.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/ini.cc,v
retrieving revision 2.59
diff -u -u -p -r2.59 ini.cc
--- ini.cc	14 Nov 2013 21:36:14 -0000	2.59
+++ ini.cc	18 Nov 2013 16:18:01 -0000
@@ -106,11 +106,11 @@ public:
     }
   virtual void warning (const std::string& message)const
     {
-      MessageBox (0, message.c_str(), "Warning", 0);
+      mbox (0, message.c_str(), "Warning", 0);
     }
   virtual void error(const std::string& message)const
     {
-      MessageBox (0, message.c_str(), "Parse Errors", 0);
+      mbox (0, message.c_str(), "Parse Errors", 0);
     }
   virtual ~ GuiParseFeedback ()
     {
Index: msg.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/msg.cc,v
retrieving revision 2.9
diff -u -u -p -r2.9 msg.cc
--- msg.cc	7 Aug 2008 22:59:17 -0000	2.9
+++ msg.cc	18 Nov 2013 16:18:01 -0000
@@ -41,15 +41,9 @@ msg (const char *fmt, ...)
   OutputDebugString (buf);
 }
 
-static int
-mbox (HWND owner, const char *name, int type, int id, va_list args)
+int
+mbox (HWND owner, const char *buf, const char *name, int type)
 {
-  char buf[1000], fmt[1000];
-
-  if (LoadString (hinstance, id, fmt, sizeof (fmt)) <= 0)
-    ExitProcess (0);
-
-  vsnprintf (buf, 1000, fmt, args);
   log (LOG_PLAIN) << "mbox " << name << ": " << buf << endLog;
   if (unattended_mode)
     {
@@ -79,6 +73,18 @@ mbox (HWND owner, const char *name, int 
   return MessageBox (owner, buf, "Cygwin Setup", type);
 }
 
+static int
+mbox (HWND owner, const char *name, int type, int id, va_list args)
+{
+  char buf[1000], fmt[1000];
+
+  if (LoadString (hinstance, id, fmt, sizeof (fmt)) <= 0)
+    ExitProcess (0);
+
+  vsnprintf (buf, 1000, fmt, args);
+  return mbox(owner, buf, name, type);
+}
+
 void
 note (HWND owner, int id, ...)
 {
Index: msg.h
===================================================================
RCS file: /cvs/cygwin-apps/setup/msg.h,v
retrieving revision 2.4
diff -u -u -p -r2.4 msg.h
--- msg.h	29 Aug 2004 16:59:40 -0000	2.4
+++ msg.h	18 Nov 2013 16:18:01 -0000
@@ -37,4 +37,7 @@ void note (HWND owner, int id, ...);
 /* returns IDYES or IDNO, otherwise same as note() */
 int yesno (HWND owner, int id, ...);
 
+/* general MessageBox() wrapper which understands unattended mode */
+int mbox (HWND owner, const char *buf, const char *name, int type);
+
 #endif /* SETUP_MSG_H */

             reply	other threads:[~2013-11-18 16:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-18 16:49 Jon TURNEY [this message]
2013-11-19 11:21 ` Corinna Vinschen

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=528A44B3.4020706@dronecode.org.uk \
    --to=jon.turney@dronecode.org.uk \
    --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).