If the user unchecks the box, remove all sites except for fresh mirrors and selected stale mirrors. Introduce a new function remove_user_urls() to help with this --- site.cc | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
diff --git a/site.cc b/site.cc index dbb07d4..d4550a1 100644 --- a/site.cc +++ b/site.cc @@ -258,6 +258,35 @@ check_for_user_urls () } } +static void +remove_user_urls () +{ + SiteList result; + for (SiteList::const_iterator i = all_site_list.begin (); + i != all_site_list.end (); i++) + { + if (i->from_mirrors_lst) + // It's a fresh mirror. + result.push_back (*i); + else + { + // Is it selected? + SiteList::iterator j = find (site_list.begin (), + site_list.end (), *i); + if (j != site_list.end ()) + { + if (find (cached_site_list.begin (), cached_site_list.end (), *i) + != cached_site_list.end ()) + // It's a selected stale mirror. + result.push_back (*i); + else + site_list.erase (j); + } + } + } + all_site_list = result; +} + // This is called only for lists of mirrors that came (now or in a // previous setup run) from mirrors.lst. void @@ -756,6 +785,12 @@ bool SitePage::OnMessageCmd (int id, HWND hwndctl, UINT code) if (code == BN_CLICKED) { allow_user_url = IsButtonChecked (IDC_ALLOW_USER_URL); + if (!allow_user_url) + { + // The button was just unchecked. + remove_user_urls (); + PopulateListBox (); + } CheckControlsAndDisableAccordingly (); } break; -- 2.15.1