public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
* [PATCH] Don't show setup version warning message box in unattended mode
@ 2013-11-18 16:49 Jon TURNEY
  2013-11-19 11:21 ` Corinna Vinschen
  0 siblings, 1 reply; 2+ messages in thread
From: Jon TURNEY @ 2013-11-18 16:49 UTC (permalink / raw)
  To: cygwin-apps

[-- 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 */

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Don't show setup version warning message box in unattended mode
  2013-11-18 16:49 [PATCH] Don't show setup version warning message box in unattended mode Jon TURNEY
@ 2013-11-19 11:21 ` Corinna Vinschen
  0 siblings, 0 replies; 2+ messages in thread
From: Corinna Vinschen @ 2013-11-19 11:21 UTC (permalink / raw)
  To: cygwin-apps

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

Hi Jon,

On Nov 18 16:47, Jon TURNEY wrote:
> 
> 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  <...>
> 
> 	* msg.cc (mbox): Generalize to a MessgeBox() wrapper which knows
                                         ^^^^^^^^^^^
                                         typo.  Also, just remove the "()",
                                         they are unnecessary.

> 	what to do in unattended mode.
> 	* msg.h: Add prototype.
> 	* ini.cc (IniParseFeedback): Use here rather than MessageBox().
                                                                    ^^
                                                                    same here.

Other than this minor ChangeLog nit, the patch looks good, please apply.
If you fix further MessageBox usages to work fine in attended and
unattended mode, consider them pre-approved.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-11-19 11:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-18 16:49 [PATCH] Don't show setup version warning message box in unattended mode Jon TURNEY
2013-11-19 11:21 ` Corinna Vinschen

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).