This is the mail archive of the
cygwin-apps
mailing list for the Cygwin project.
[PATCH setup 2/4] Set the initial state of IDC_ALLOW_USER_URL
- From: Ken Brown <kbrown at cornell dot edu>
- To: cygwin-apps at cygwin dot com
- Date: Sun, 3 Dec 2017 10:22:53 -0500
- Subject: [PATCH setup 2/4] Set the initial state of IDC_ALLOW_USER_URL
- Authentication-results: sourceware.org; auth=none
- References: <20171203152255.7368-1-kbrown@cornell.edu>
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 4fbf30d..dbb07d4 100644
--- a/site.cc
+++ b/site.cc
@@ -241,6 +241,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
@@ -365,6 +382,8 @@ get_site_list (HINSTANCE h, HWND owner)
delete[] theMirrorString;
delete[] theCachedString;
+ check_for_user_urls ();
+
return 0;
}
@@ -568,6 +587,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