[PATCH] Setup: adjust copyright and fix the "installation finished" behavior for download-only mode

Igor Peshansky pechtcha@cs.nyu.edu
Tue Apr 10 14:17:00 GMT 2007


On Mon, 9 Apr 2007, Brian Dessent wrote:

> Igor Peshansky wrote:
>
> > The attached patch fixes the seemingly abrupt exit in download-only mode
> > reported in <http://cygwin.com/ml/cygwin/2007-04/msg00251.html> (and also
> > adds 2007 to the copyright range).  The ChangeLog is below.  Comments
> > welcome.  Please let me know if it's ok to commit.
>
> Looks good, please commit.

Thanks, but it turns out the patch wasn't tested enough.  Using the "Back"
button from the final dialog in download-only mode and then going through
setup again after changing the mode to "Install" would not change the
final dialog back to its original state.  The attached patch fixes that
(and also makes sure no extra files are created in download-only mode).
New ChangeLog below.

> I knew that copyright year display stuff would come up again.  I'm
> tempted to just remove it; I'm not really seeing what good it does to
> display that to the user.  And according to the GNU coding standards,
> we're supposed to bump the copyright year in the header of any source
> file whenever we make changes to it, which I don't think any of us have
> been bothering with either.  Sigh.

Well, I've adjusted it on the splash screen anyway.  And yes, I haven't
really adjusted it in the headers of the sources...  Sigh, indeed.
	Igor
==============================================================================
ChangeLog:
2007-04-10  Igor Peshansky  <pechtcha@cs.nyu.edu>

	* resource.h (IDC_STATIC_HEADER): New control id.
	* res.rc (IDD_SPLASH): Adjust copyright.
	(IDD_DESKTOP): Make header text accessible as a separate control.
	* desktop.cc (set_status): Use eset() instead of SetWindowText().
	(header_string,message_string): New static variables.
	(load_dialog): Disable checkboxes and change dialog text in
	download-only mode.  Save header and message text; restore it if
	mode changes back to install.
	(DesktopSetupPage::OnInit): Move functionality to
	DesktopSetupPage::OnActivate.
	(DesktopSetupPage::OnActivate): Disable checkboxes in download-only
	mode.
	(DesktopSetupPage::OnFinish): Avoid creating shortcuts in
	download-only mode.
	* desktop.h (DesktopSetupPage::OnActivate): Override virtual function.
	* threebar.cc (ThreeBarProgressPage::OnMessageApp): Deprecate the
	default fallthrough.
	* download.cc (do_download_thread): Explicitly return the next
	dialog.

-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha@cs.nyu.edu | igor@watson.ibm.com
ZZZzz /,`.-'`'    -.  ;-;;,_		Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'		old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Freedom is just another word for "nothing left to lose"...  -- Janis Joplin
-------------- next part --------------
Index: desktop.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/desktop.cc,v
retrieving revision 2.47
diff -u -p -r2.47 desktop.cc
--- desktop.cc	30 Mar 2007 22:18:34 -0000	2.47
+++ desktop.cc	10 Apr 2007 14:02:21 -0000
@@ -245,15 +245,38 @@ set_status (HWND h)
   if (LoadString (hinstance, exit_msg, fmt, sizeof (fmt)) > 0)
     {
       snprintf (buf, 1000, fmt, backslash(theLog->getFileName(LOG_BABBLE)).c_str());
-      ::SetWindowText (GetDlgItem (h, IDC_STATUS), buf);
+      eset(h, IDC_STATUS, buf);
     }
 }
 
+static char *header_string = NULL;
+static char *message_string = NULL;
 static void
 load_dialog (HWND h)
 {
-  rbset (h, da, root_desktop);
-  rbset (h, ma, root_menu);
+  if (source == IDC_SOURCE_DOWNLOAD)
+    {
+      // Don't need the checkboxes
+      EnableWindow (GetDlgItem (h, IDC_ROOT_DESKTOP), FALSE);
+      EnableWindow (GetDlgItem (h, IDC_ROOT_MENU), FALSE);
+      if (header_string == NULL)
+        header_string = eget (h, IDC_STATIC_HEADER_TITLE, header_string);
+      if (message_string == NULL) 
+        message_string = eget (h, IDC_STATIC_HEADER, message_string);
+      eset (h, IDC_STATIC_HEADER_TITLE, "Installation complete");
+      eset (h, IDC_STATIC_HEADER, "Shows installation status in download-only mode.");
+    }
+  else
+    {
+      EnableWindow (GetDlgItem (h, IDC_ROOT_DESKTOP), TRUE);
+      EnableWindow (GetDlgItem (h, IDC_ROOT_MENU), TRUE);
+      if (header_string != NULL)
+        eset (h, IDC_STATIC_HEADER_TITLE, header_string);
+      if (message_string != NULL)
+        eset (h, IDC_STATIC_HEADER, message_string);
+      rbset (h, da, root_desktop);
+      rbset (h, ma, root_menu);
+    }
   check_if_enable_next (h);
   set_status (h);
 }
@@ -359,7 +382,13 @@ DesktopSetupPage::OnInit ()
   // FIXME: This CoInitialize() feels like it could be moved to startup in main.cc.
   CoInitialize (NULL);
 
-  if (NoShortcutsOption) 
+  SetDlgItemFont(IDC_STATUS_HEADER, "MS Shell Dlg", 8, FW_BOLD);
+}
+
+void
+DesktopSetupPage::OnActivate ()
+{
+  if (NoShortcutsOption || source == IDC_SOURCE_DOWNLOAD) 
     {
       root_desktop = root_menu = 0;
     }
@@ -388,8 +417,6 @@ DesktopSetupPage::OnInit ()
     }
 
   load_dialog (GetHWND ());
-
-  SetDlgItemFont(IDC_STATUS_HEADER, "MS Shell Dlg", 8, FW_BOLD);
 }
 
 long
@@ -405,7 +432,8 @@ DesktopSetupPage::OnFinish ()
 {
   HWND h = GetHWND ();
   save_dialog (h);
-  do_desktop_setup ();
+  if (source != IDC_SOURCE_DOWNLOAD)
+    do_desktop_setup ();
 
   return true;
 }
Index: desktop.h
===================================================================
RCS file: /cvs/cygwin-apps/setup/desktop.h,v
retrieving revision 2.7
diff -u -p -r2.7 desktop.h
--- desktop.h	30 Mar 2007 22:18:34 -0000	2.7
+++ desktop.h	10 Apr 2007 14:02:21 -0000
@@ -35,6 +35,7 @@ public:
   bool Create ();
 
   virtual void OnInit ();
+  virtual void OnActivate ();
   virtual bool OnFinish ();
   virtual long OnBack ();
   virtual long OnUnattended ();
Index: download.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/download.cc,v
retrieving revision 2.48
diff -u -p -r2.48 download.cc
--- download.cc	16 Apr 2006 15:37:49 -0000	2.48
+++ download.cc	10 Apr 2007 14:02:21 -0000
@@ -287,7 +287,7 @@ do_download_thread (HINSTANCE h, HWND ow
 	exit_msg = IDS_DOWNLOAD_INCOMPLETE;
       else if (!unattended_mode)
 	exit_msg = IDS_DOWNLOAD_COMPLETE;
-      return 0;
+      return IDD_DESKTOP;
     }
   else
     return IDD_S_INSTALL;
Index: res.rc
===================================================================
RCS file: /cvs/cygwin-apps/setup/res.rc,v
retrieving revision 2.72
diff -u -p -r2.72 res.rc
--- res.rc	30 Mar 2007 22:18:34 -0000	2.72
+++ res.rc	10 Apr 2007 14:02:21 -0000
@@ -265,7 +265,7 @@ BEGIN
                     "necessary.",IDC_SPLASH_TEXT,115,25,195,90
     ICON            IDI_CYGWIN,IDC_SPLASH_ICON,114,114,21,20,WS_GROUP
     LTEXT           "Version (unknown)",IDC_VERSION,115,137,195,10
-    LTEXT           "Copyright 2000-2006",IDC_SPLASH_COPYR,115,150,195,8
+    LTEXT           "Copyright 2000-2007",IDC_SPLASH_COPYR,115,150,195,8
     LTEXT           "http://www.cygwin.com/",IDC_SPLASH_URL,115,162,90,8
 END
 
@@ -283,7 +283,7 @@ BEGIN
     CONTROL         "",IDC_HEADSEPARATOR,"Static",SS_BLACKFRAME | SS_SUNKEN,0,28,
                     317,1
     LTEXT           "Tell setup if you want it to create a few icons for convenient access to the Cygwin environment.",
-                    IDC_STATIC,21,9,239,16,NOT WS_GROUP
+                    IDC_STATIC_HEADER,21,9,239,16,NOT WS_GROUP
     LTEXT           "Create Icons",IDC_STATIC_HEADER_TITLE,7,0,258,8,NOT 
                     WS_GROUP
     CONTROL         "",IDC_DESKTOP_SEPARATOR,"Static",SS_BLACKFRAME | SS_SUNKEN,
Index: resource.h
===================================================================
RCS file: /cvs/cygwin-apps/setup/resource.h,v
retrieving revision 2.34
diff -u -p -r2.34 resource.h
--- resource.h	30 Mar 2007 22:18:34 -0000	2.34
+++ resource.h	10 Apr 2007 14:02:21 -0000
@@ -158,3 +158,4 @@
 #define IDC_DESKTOP_SEPARATOR             581
 #define IDC_STATUS_HEADER                 582
 #define IDC_STATUS                        583
+#define IDC_STATIC_HEADER                 584
Index: threebar.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/threebar.cc,v
retrieving revision 2.11
diff -u -p -r2.11 threebar.cc
--- threebar.cc	30 Mar 2006 20:30:50 -0000	2.11
+++ threebar.cc	10 Apr 2007 14:02:22 -0000
@@ -179,13 +179,12 @@ ThreeBarProgressPage::OnMessageApp (UINT
 	  }
 	else if (lParam != 0)
 	  {
-	    // Download failed for some reason, go back to site selection page
+	    // Download either failed or completed in download-only mode.
 	    GetOwner ()->SetActivePageByID (lParam);
 	  }
 	else
 	  {
-	    // Was a download-only, and is complete or failed.
-	    GetOwner ()->PressButton (PSBTN_CANCEL);
+	    fatal("Unexpected fallthrough from the download thread", NO_ERROR);
 	  }
 	break;
       }


More information about the Cygwin-apps mailing list