This is the mail archive of the cygwin-apps 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]

[PATCH setup v2 2/5] Set the initial state of IDC_ALLOW_USER_URL


It starts checked if all_site_list contains a site that is not a
cygwin.com mirror.  Such a site would have to come from the
"last-mirror" user setting, indicating that the user used a non-mirror
on the last run.  Introduce a new function check_for_user_urls() to
help with this.
---
 site.cc | 26 ++++++++++++++++++++++++++
 site.h  |  1 +
 2 files changed, 27 insertions(+)

diff --git a/site.cc b/site.cc
index 607c591..0222ec9 100644
--- a/site.cc
+++ b/site.cc
@@ -242,6 +242,23 @@ save_dialog (HWND h)
     }
 }
 
+// Does the_site_list contain any sites that are not mirrors (possibly stale)?
+static void
+check_for_user_urls ()
+{
+  for (SiteList::const_iterator i = all_site_list.begin ();
+       i != all_site_list.end (); i++)
+    {
+      if (!i->from_mirrors_lst
+	  && (find (cached_site_list.begin (), cached_site_list.end (), *i)
+	      == cached_site_list.end ()))
+	{
+	  allow_user_url = true;
+	  return;
+	}
+    }
+}
+
 // This is called only for lists of mirrors that came (now or in a
 // previous setup run) from mirrors.lst.
 void
@@ -366,6 +383,8 @@ get_site_list (HINSTANCE h, HWND owner)
   delete[] theMirrorString;
   delete[] theCachedString;
 
+  check_for_user_urls ();
+
   return 0;
 }
 
@@ -569,6 +588,13 @@ bool SitePage::Create ()
   return PropertyPage::Create (IDD_SITE);
 }
 
+void
+SitePage::OnInit ()
+{
+  int a = allow_user_url ? BST_CHECKED : BST_UNCHECKED;
+  CheckDlgButton (GetHWND (), IDC_ALLOW_USER_URL, a);
+}
+
 long
 SitePage::OnNext ()
 {
diff --git a/site.h b/site.h
index d16db8e..c517ac2 100644
--- a/site.h
+++ b/site.h
@@ -31,6 +31,7 @@ public:
 
   bool Create ();
 
+  virtual void OnInit ();
   virtual void OnActivate ();
   virtual long OnNext ();
   virtual long OnBack ();
-- 
2.15.1


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