[PINGADINGDING]: [setup PATCH] Rework do_download [next_dialog removal (2b)]
Gary R. Van Sickle
g.r.vansickle@worldnet.att.net
Tue Sep 30 06:13:00 GMT 2003
Rob?
--
Gary R. Van Sickle
Brewer. Patriot.
> Ping?
>
> Robert, did you miss this one?
>
> I ask because it should be fairly simple to review, being an application of
> the general pronciples already approved in 2a to another region of code.
>
> If it is queued waiting for you to have time, please let me know.
>
> After this, there is only one more trivial commit to actually remove the
> definition of next_dialog itself.
>
>
> Max.
>
>
> >> +2003-07-30 Max Bowsher <maxb@ukf.net>
> >> +
> >> + * download.cc (do_download_thread): Return bool. Move program flow
> >> + logic to threebar.cc.
> >> + (do_download_thread_reflector): Put returned bool in lParam.
> >> + * threebar.cc: Include "msg.h".
> >> + (WM_APP_DOWNLOAD_THREAD_COMPLETE): Rework for new meaning of lParam,
> >> + incorporating program flow logic from download.cc.
> >>
> >> Index: download.cc
> >> ===================================================================
> >> RCS file: /home/max/cvsmirror/cygwin-apps-cvs/setup/download.cc,v
> >> retrieving revision 2.37
> >> diff -u -p -r2.37 download.cc
> >> --- download.cc 7 Apr 2003 12:46:55 -0000 2.37
> >> +++ download.cc 30 Jul 2003 22:03:05 -0000
> >> @@ -221,7 +221,7 @@ download_one (packagesource & pkgsource,
> >> return 1;
> >> }
> >>
> >> -static void
> >> +static bool
> >> do_download_thread (HINSTANCE h, HWND owner)
> >> {
> >> int errors = 0;
> >> @@ -302,25 +302,7 @@ do_download_thread (HINSTANCE h, HWND ow
> >> }
> >> }
> >>
> >> - if (errors)
> >> - {
> >> - if (yesno (owner, IDS_DOWNLOAD_INCOMPLETE) == IDYES)
> >> - {
> >> - next_dialog = IDD_SITE;
> >> - return;
> >> - }
> >> - }
> >> -
> >> - if (source == IDC_SOURCE_DOWNLOAD)
> >> - {
> >> - if (errors)
> >> - exit_msg = IDS_DOWNLOAD_INCOMPLETE;
> >> - else if (!unattended_mode)
> >> - exit_msg = IDS_DOWNLOAD_COMPLETE;
> >> - next_dialog = 0;
> >> - }
> >> - else
> >> - next_dialog = IDD_S_INSTALL;
> >> + return (errors == 0);
> >> }
> >>
> >> static DWORD WINAPI
> >> @@ -329,10 +311,11 @@ do_download_reflector (void *p)
> >> HANDLE *context;
> >> context = (HANDLE *) p;
> >>
> >> - do_download_thread ((HINSTANCE) context[0], (HWND) context[1]);
> >> + bool succeeded = do_download_thread ((HINSTANCE) context[0],
> >> + (HWND) context[1]);
> >>
> >> // Tell the progress page that we're done downloading
> >> - Progress.PostMessage (WM_APP_DOWNLOAD_THREAD_COMPLETE, 0,
> next_dialog);
> >> + Progress.PostMessage (WM_APP_DOWNLOAD_THREAD_COMPLETE, 0, succeeded);
> >>
> >> ExitThread(0);
> >> }
> >> Index: threebar.cc
> >> ===================================================================
> >> RCS file: /home/max/cvsmirror/cygwin-apps-cvs/setup/threebar.cc,v
> >> retrieving revision 2.7
> >> diff -u -p -r2.7 threebar.cc
> >> --- threebar.cc 30 Jul 2003 21:49:53 -0000 2.7
> >> +++ threebar.cc 30 Jul 2003 22:05:48 -0000
> >> @@ -27,6 +27,7 @@
> >> #include "threebar.h"
> >> #include "cistring.h"
> >> #include "state.h"
> >> +#include "msg.h"
> >>
> >> bool ThreeBarProgressPage::Create ()
> >> {
> >> @@ -148,21 +149,32 @@ ThreeBarProgressPage::OnMessageApp (UINT
> >> }
> >> case WM_APP_DOWNLOAD_THREAD_COMPLETE:
> >> {
> >> - if (lParam == IDD_S_INSTALL)
> >> + if (!lParam)
> >> {
> >> - // Download is complete and we want to go on to the install.
> >> - Window::PostMessage (WM_APP_START_INSTALL);
> >> + if (yesno (GetHWND(), IDS_DOWNLOAD_INCOMPLETE) == IDYES)
> >> + {
> >> + // Download failed for some reason,
> >> + // go back to site selection page
> >> + GetOwner ()->SetActivePageByID (IDD_SITE);
> >> + break;
> >> + }
> >> }
> >> - else if (lParam != 0)
> >> +
> >> + if (source == IDC_SOURCE_DOWNLOAD)
> >> {
> >> - // Download failed for some reason, go back to site selection page
> >> - GetOwner ()->SetActivePageByID (lParam);
> >> + if (!lParam)
> >> + exit_msg = IDS_DOWNLOAD_INCOMPLETE;
> >> + else if (!unattended_mode)
> >> + exit_msg = IDS_DOWNLOAD_COMPLETE;
> >> + // Was a download-only, and is complete or failed.
> >> + GetOwner ()->PressButton (PSBTN_CANCEL);
> >> }
> >> else
> >> {
> >> - // Was a download-only, and is complete or failed.
> >> - GetOwner ()->PressButton (PSBTN_CANCEL);
> >> + // Download is complete and we want to go on to the install.
> >> + Window::PostMessage (WM_APP_START_INSTALL);
> >> }
> >> +
> >> break;
> >> }
> >> case WM_APP_START_INSTALL:
>
More information about the Cygwin-apps
mailing list