This is the mail archive of the cygwin-apps@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [setup PATCH] Rework do_ini [next_dialog removal (2a)]


Robert Collins wrote:
> On Wed, 2003-07-30 at 18:34, Max Bowsher wrote:
>
>> This is just as well, since currently if IDD_S_LOAD_INI does got posted
back
>> to threebar.cc, setup hangs on the progress page, since do_fromcwd does
not
>> do what the code in threebar.cc seems to believe it does.
>>
>> So, I'm adding an exit in a very narrow edge case (and the exit is
>> implicitly a "FIXME: Use an Exception").
>
> Ok, that makes sense. Please make a small note in the code - "TODO,
> return to do_local_ini / the source selection screen", and also make it
> with //FIXME: throw an exception".
>
> Do those two things, and it's approved.

Actually, that TODO is trivial, so I've done it. Also found a bug in my
previous patch (one SetActivePageByID (lParam) remained) - fixed.

New patch (ini.cc changes are identical to previous patch):

+2003-07-30  Max Bowsher  <maxb@ukf.net>
+
+ * ini.cc (do_ini_thread): Return bool.
+ (do_ini_thread_reflector): Put returned bool in lParam.
+ * threebar.cc (WM_APP_SETUP_INI_DOWNLOAD_COMPLETE): Rework for new
+ meaning of lParam. Replace erroneous use of do_fromcwd with
+ SetActivePageByID (IDD_SOURCE).
+

Index: threebar.cc
===================================================================
RCS file: /home/max/cvsmirror/cygwin-apps-cvs/setup/threebar.cc,v
retrieving revision 2.6
diff -u -p -r2.6 threebar.cc
--- threebar.cc 30 Jul 2003 00:04:56 -0000 2.6
+++ threebar.cc 30 Jul 2003 10:03:18 -0000
@@ -26,6 +26,7 @@
 #include "propsheet.h"
 #include "threebar.h"
 #include "cistring.h"
+#include "state.h"

 bool ThreeBarProgressPage::Create ()
 {
@@ -206,14 +207,23 @@ ThreeBarProgressPage::OnMessageApp (UINT
       }
     case WM_APP_SETUP_INI_DOWNLOAD_COMPLETE:
       {
- if (lParam == IDD_S_FROM_CWD)
+ if (lParam)
    {
-     // There isn't actually a dialog template named this
-     do_fromcwd (GetInstance (), GetHWND ());
+     GetOwner ()->SetActivePageByID (IDD_CHOOSE);
    }
  else
    {
-     GetOwner ()->SetActivePageByID (lParam);
+     if (source == IDC_SOURCE_CWD)
+       {
+  // There was a setup.ini file (as found by
+  // do_fromcwd), but it had parse errors.
+  GetOwner ()->SetActivePageByID (IDD_SOURCE);
+       }
+     else
+       {
+  // Download failed, try another site.
+  GetOwner ()->SetActivePageByID (IDD_SITE);
+       }
    }
  break;
       }
Index: ini.cc
===================================================================
RCS file: /home/max/cvsmirror/cygwin-apps-cvs/setup/ini.cc,v
retrieving revision 2.35
diff -u -p -r2.35 ini.cc
--- ini.cc 5 Jul 2002 05:17:21 -0000 2.35
+++ ini.cc 29 Jul 2003 13:17:34 -0000
@@ -203,7 +203,7 @@ do_remote_ini (HWND owner)
   return ini_count;
 }

-static void
+static bool
 do_ini_thread (HINSTANCE h, HWND owner)
 {
   size_t ini_count = 0;
@@ -213,10 +213,7 @@ do_ini_thread (HINSTANCE h, HWND owner)
     ini_count = do_remote_ini (owner);

   if (ini_count == 0)
-    {
-      next_dialog = source == IDC_SOURCE_CWD ? IDD_S_FROM_CWD : IDD_SITE;
-      return;
-    }
+    return false;

   if (get_root_dir ().cstr_oneuse())
     {
@@ -266,7 +263,7 @@ do_ini_thread (HINSTANCE h, HWND owner)
  note (owner, IDS_OLD_SETUP_VERSION, version, setup_version.cstr_oneuse());
     }

-  next_dialog = IDD_CHOOSE;
+  return true;
 }

 static DWORD WINAPI
@@ -275,10 +272,10 @@ do_ini_thread_reflector(void* p)
  HANDLE *context;
  context = (HANDLE*)p;

- do_ini_thread((HINSTANCE)context[0], (HWND)context[1]);
+ bool succeeded = do_ini_thread((HINSTANCE)context[0], (HWND)context[1]);

  // Tell the progress page that we're done downloading
- Progress.PostMessage(WM_APP_SETUP_INI_DOWNLOAD_COMPLETE, 0, next_dialog);
+ Progress.PostMessage(WM_APP_SETUP_INI_DOWNLOAD_COMPLETE, 0, succeeded);

  ExitThread(0);
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]