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
Cc: Jon TURNEY <jon.turney@dronecode.org.uk>
Subject: [PATCH setup 2/4] Add a 'Retry' button to the IDD_FILE_INUSE dialog
Date: Mon, 02 Mar 2015 13:55:00 -0000	[thread overview]
Message-ID: <1425304525-12268-3-git-send-email-jon.turney@dronecode.org.uk> (raw)
In-Reply-To: <1425304525-12268-1-git-send-email-jon.turney@dronecode.org.uk>

I have been meaning to add this for a while, and was reminded of this by [1],
although that is really about a different problem.

[1] https://cygwin.com/ml/cygwin/2015-02/msg00679.html

Add a 'Retry' button to the IDD_FILE_INUSE dialog, to press when you want to
manually stop the processes which were preventing a file from being replaced,
after you have done so.

Unfortunately the IDD_FILE_INUSE DIALOG is already rather cramped, so define
SETUP_MEDIUM_DIALOG_DIMS for a medium-size dialog, and adjust the dialog layout
appropriately.

Also do a bit of polish on the text used: "you will need to reboot" -> "the file
will be updated after a reboot"

XXX: This text should be dynamic, and should not appear if the NoReplaceOnReboot
option has been used.

Also spread out the text in the fallback MessageBox used when we can't enumerate
the processes which have the file in-use.

XXX: Note that there is no user notification, only a log message, if scheduling
a file to be replaced on reboot failed.

2015-03-02  Jon TURNEY  <jon.turney@dronecode.org.uk>

	* res.rc (IDD_FILE_INUSE): Add 'Retry' button. Make larger.
	* install.cc (FileInuseDlgProc): Polish text.  Handle IDIGNORE.
	(installOne): Ditto.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
---
 install.cc | 22 ++++++++++++++--------
 res.rc     | 25 +++++++++++++++----------
 2 files changed, 29 insertions(+), 18 deletions(-)

diff --git a/install.cc b/install.cc
index 2162902..aa7c2e9 100644
--- a/install.cc
+++ b/install.cc
@@ -261,16 +261,18 @@ FileInuseDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
           case 1:
             SetDlgItemText (hwndDlg, IDRETRY, "&Kill Processes");
             SetDlgItemText (hwndDlg, IDC_FILE_INUSE_HELP,
-                            "Select 'Kill' to kill Cygwin processes and retry, or "
-                            "select 'Continue' to go on anyway (you will need to reboot).");
+                            "Select 'Retry' to retry, "
+                            "Select 'Kill' to kill processes and retry, or "
+                            "select 'Continue' to go on anyway (the file will be updated after a reboot).");
             break;
 
           default:
           case 2:
             SetDlgItemText (hwndDlg, IDRETRY, "&Kill Processes");
             SetDlgItemText (hwndDlg, IDC_FILE_INUSE_HELP,
-                            "Select 'Kill' to forcibly kill all processes and retry, or "
-                            "select 'Continue' to go on anyway (you will need to reboot).");
+                            "Select 'Retry' to retry, "
+                            "select 'Kill' to forcibly kill all processes and retry, or "
+                            "select 'Continue' to go on anyway (the file will be updated after a reboot).");
           }
       }
       return TRUE; // automatically set focus, please
@@ -280,6 +282,7 @@ FileInuseDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
         {
           switch (LOWORD (wParam))
             {
+            case IDIGNORE:
             case IDRETRY:
             case IDCONTINUE:
               EndDialog (hwndDlg, LOWORD (wParam));
@@ -543,10 +546,10 @@ Installer::installOne (packagemeta &pkgm, const packageversion &ver,
                             // to fix the problem themselves
                             char msg[fn.size() + 300];
                             sprintf (msg,
-                                     "Unable to extract /%s\r\n"
-                                     "The file is in use or some other error occurred.\r\n"
-                                     "Please stop all Cygwin processes and select \"Retry\", or\r\n"
-                                     "select \"Continue\" to go on anyway (you will need to reboot).\r\n",
+                                     "Unable to extract /%s\r\n\r\n"
+                                     "The file is in use or some other error occurred.\r\n\r\n"
+                                     "Please stop all Cygwin processes and select \"Retry\", or "
+                                     "select \"Continue\" to go on anyway (the file will be updated after a reboot).\r\n",
                                      fn.c_str());
 
                             rc = MessageBox (owner, msg, "Error writing file",
@@ -556,6 +559,9 @@ Installer::installOne (packagemeta &pkgm, const packageversion &ver,
 
                     switch (rc)
                       {
+                      case IDIGNORE:
+                        // manual intervention may have fixed the problem, retry
+                        continue;
                       case IDRETRY:
                         if (!processes.empty())
                           {
diff --git a/res.rc b/res.rc
index 9339b53..5013b31 100644
--- a/res.rc
+++ b/res.rc
@@ -3,10 +3,13 @@
 
 #define SETUP_STANDARD_DIALOG_W	339
 #define SETUP_STANDARD_DIALOG_H	179
+#define SETUP_MEDIUM_DIALOG_W		277
+#define SETUP_MEDIUM_DIALOG_H		137
 #define SETUP_SMALL_DIALOG_W		215
 #define SETUP_SMALL_DIALOG_H		95
 
 #define SETUP_STANDARD_DIALOG_DIMS	SETUP_STANDARD_DIALOG_W, SETUP_STANDARD_DIALOG_H
+#define SETUP_MEDIUM_DIALOG_DIMS	SETUP_MEDIUM_DIALOG_W, SETUP_MEDIUM_DIALOG_H
 #define SETUP_SMALL_DIALOG_DIMS	SETUP_SMALL_DIALOG_W, SETUP_SMALL_DIALOG_H
 
 #define SETUP_HEADICON_X		(SETUP_STANDARD_DIALOG_W - 27)
@@ -428,24 +431,26 @@ BEGIN
 
 END
 
-IDD_FILE_INUSE DIALOG DISCARDABLE  0, 0, SETUP_SMALL_DIALOG_DIMS
+IDD_FILE_INUSE DIALOG DISCARDABLE  0, 0, SETUP_MEDIUM_DIALOG_DIMS
 STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION
 CAPTION "In-use file detected"
 FONT 8, "MS Shell Dlg"
 BEGIN
-    ICON            IDI_WARNING,IDC_HEADICON,5,5
+    ICON            IDI_WARNING,IDC_HEADICON,10,10
     LTEXT           "Unable to extract %s",
-                    IDC_FILE_INUSE_MSG,27,5,183,8,SS_PATHELLIPSIS
+                    IDC_FILE_INUSE_MSG,33,10,234,8,SS_PATHELLIPSIS
     LTEXT           "The file is in use by the following processes:",
-                    IDC_STATIC,27,14,183,8
-    EDITTEXT        IDC_FILE_INUSE_EDIT,27,23,183,28,WS_VSCROLL |
+                    IDC_STATIC,33,28,234,8
+    EDITTEXT        IDC_FILE_INUSE_EDIT,33,40,234,32,WS_VSCROLL |
                     ES_LEFT | ES_MULTILINE | ES_READONLY |
                     ES_AUTOVSCROLL | NOT WS_TABSTOP
-    LTEXT           "Select 'Stop' to stop Cygwin processes and retry, or "
-                    "select 'Continue' to go on anyway (you will need to reboot).",
-                    IDC_FILE_INUSE_HELP,27,52,183,16,NOT WS_GROUP
-    DEFPUSHBUTTON   "&Stop Processes",IDRETRY,47,75,55,15
-    PUSHBUTTON      "&Continue",IDCONTINUE,113,75,55,15
+    LTEXT           "Select 'Retry' to retry, "
+                    "select 'Stop' to stop processes and retry, or "
+                    "select 'Continue' to go on anyway (the file will be updated after a reboot).",
+                    IDC_FILE_INUSE_HELP,33,80,234,24,NOT WS_GROUP
+    PUSHBUTTON      "&Retry",IDIGNORE,45,112,55,15
+    DEFPUSHBUTTON   "&Stop Processes",IDRETRY,111,112,55,15
+    PUSHBUTTON      "&Continue",IDCONTINUE,177,112,55,15
 END
 
 /////////////////////////////////////////////////////////////////////////////
-- 
2.1.4

  reply	other threads:[~2015-03-02 13:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-02 13:55 [PATCH setup 0/4] Setup misc patches Jon TURNEY
2015-03-02 13:55 ` Jon TURNEY [this message]
2015-03-02 16:28   ` [PATCH setup 2/4] Add a 'Retry' button to the IDD_FILE_INUSE dialog Corinna Vinschen
2015-03-02 13:55 ` [PATCH setup 3/4] Don't write LOG_BABBLE output to stdout Jon TURNEY
2015-03-02 16:29   ` Corinna Vinschen
2015-03-02 13:55 ` [PATCH setup 1/4] Fix truncation of "Bin?" and "Src?" column headers Jon TURNEY
2015-03-02 15:58   ` Corinna Vinschen
2015-03-02 13:56 ` [PATCH setup 4/4] Remove msg() from LogFile::endEntry() Jon TURNEY
2015-03-02 16:32   ` 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=1425304525-12268-3-git-send-email-jon.turney@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).