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/5] Simplify LocalDirPage::OnNext()
Date: Tue, 07 Nov 2017 18:17:00 -0000	[thread overview]
Message-ID: <20171107181703.51016-2-jon.turney@dronecode.org.uk> (raw)
In-Reply-To: <20171107181703.51016-1-jon.turney@dronecode.org.uk>

Never go directly to IDD_CHOOSE from LocalDirPage::OnNext(), go to
IDD_INSTATUS with WM_APP_START_SETUP_INI_DOWNLOAD (if source ==
IDC_SOURCE_LOCALDIR), otherwise IDD_NET (which eventually leads there)
---
 localdir.cc | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/localdir.cc b/localdir.cc
index 4a7ce2a..0561a30 100644
--- a/localdir.cc
+++ b/localdir.cc
@@ -266,21 +266,18 @@ LocalDirPage::OnNext ()
 	{
 	  if (source == IDC_SOURCE_LOCALDIR)
 	    {
-	      if (do_from_local_dir (GetInstance (), GetHWND (), local_dir))
-		{
-		  Progress.SetActivateTask (WM_APP_START_SETUP_INI_DOWNLOAD);
-		  return IDD_INSTATUS;
-		}
-	      return IDD_CHOOSE;
+	      do_from_local_dir (GetInstance (), GetHWND (), local_dir);
+	      Progress.SetActivateTask (WM_APP_START_SETUP_INI_DOWNLOAD);
+	      return IDD_INSTATUS;
 	    }
 	}
       else if (attr == INVALID_FILE_ATTRIBUTES
 	       && (GetLastError () == ERROR_FILE_NOT_FOUND
 		   || GetLastError () == ERROR_PATH_NOT_FOUND))
 	{
-	  if (source == IDC_SOURCE_LOCALDIR && unattended_mode)
-	    return IDD_CHOOSE;
-	  else if (source == IDC_SOURCE_LOCALDIR)
+	  if (source == IDC_SOURCE_LOCALDIR)
+	   {
+	   if (!unattended_mode)
 	    {
 	      // Check the user really wants only to uninstall.
 	      char msgText[1000];
@@ -290,8 +287,12 @@ LocalDirPage::OnNext ()
 	      snprintf (msg, sizeof (msg), msgText, local_dir.c_str (),
 		        is_64bit ? "x86_64" : "x86");
 	      int ret = MessageBox (h, msg, 0, MB_ICONEXCLAMATION | MB_OKCANCEL);
-	      return (ret == IDOK) ? IDD_CHOOSE : -1;
+	      if (ret == IDCANCEL)
+                return -1;
 	    }
+	   Progress.SetActivateTask (WM_APP_START_SETUP_INI_DOWNLOAD);
+	   return IDD_INSTATUS;
+	   }
 	  else if (offer_to_create (GetHWND (), local_dir.c_str ()))
 	    return -1;
 	  tryLocalDir = true;
@@ -322,10 +323,12 @@ LocalDirPage::OnNext ()
 	    return -1;
 	  else
 	    tryLocalDir = (ret == IDRETRY);
+	    // XXX: On IDIGNORE we drop through to IDD_NET, which is wrong in
+	    // the source == IDC_SOURCE_LOCALDIR case?
 	}
     }
 
-  return 0;
+  return 0; // IDD_NET
 }
 
 long
-- 
2.15.0

  parent reply	other threads:[~2017-11-07 18:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-01 20:38 [setup topic/libsolv] Crash after incomplete download Ken Brown
2017-11-02 17:22 ` Jon Turney
2017-11-02 19:25   ` Ken Brown
2017-11-07 18:15     ` Jon Turney
2017-11-07 18:17       ` [PATCH setup 1/5] Make do_ini() succeed if found_ini_list is empty Jon Turney
2017-11-07 18:17         ` [PATCH setup 3/5] Ensure packagedb and underlying solver pool is empty before we read setup.ini Jon Turney
2017-11-07 18:17         ` [PATCH setup 4/5] Correctly order preparing packagedb for chooser Jon Turney
2017-11-07 18:17         ` Jon Turney [this message]
2017-11-07 18:17         ` [PATCH setup 5/5] More crash avoidance in SolvableVersion member functions Jon Turney
2017-11-07 23:00       ` [setup topic/libsolv] Crash after incomplete download Ken Brown

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=20171107181703.51016-2-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).