[mirrors_config] revert made changes

- there is no official way to automatically filter mirrors by country and/or rank them in ArchLinux.
- this function was always exclusive to Manjaro and therefore useless for Arch
- there no reason to make the tab appears in Archlinux except if we add support for another tool like reflector.
This commit is contained in:
Philip 2017-05-27 12:48:09 +02:00
parent 6d3a9d4a55
commit 57acdc25f3
2 changed files with 9 additions and 23 deletions

View File

@ -22,35 +22,22 @@ namespace Pamac {
string conf_path; string conf_path;
GLib.List<string> _countries ; GLib.List<string> _countries ;
public string mirrorlists_dir { get; private set; }
public string choosen_generation_method { get; private set; } public string choosen_generation_method { get; private set; }
public string choosen_country { get; private set; } public string choosen_country { get; private set; }
public unowned GLib.List<string> countries { public unowned GLib.List<string> countries {
get { get {
try { try {
var file = File.new_for_path ("/usr/bin/pacman-mirrors"); string countries_str;
if (file.query_exists ()) { int status;
string countries_str; Process.spawn_command_line_sync ("pacman-mirrors -l",
int status;
Process.spawn_command_line_sync ("pacman-mirrors -l",
out countries_str, out countries_str,
null, null,
out status); out status);
_countries = new GLib.List<string> (); _countries = new GLib.List<string> ();
if (status == 0) { if (status == 0) {
foreach (unowned string country in countries_str.split ("\n")) { foreach (unowned string country in countries_str.split ("\n")) {
_countries.append (country); _countries.append (country);
}
} }
} else {
var directory = GLib.File.new_for_path (mirrorlists_dir);
var enumerator = directory.enumerate_children (FileAttribute.STANDARD_NAME, 0);
FileInfo file_info;
_countries = new GLib.List<string> ();
while ((file_info = enumerator.next_file ()) != null) {
_countries.append(file_info.get_name ());
}
_countries.sort (strcmp);
} }
} catch (SpawnError e) { } catch (SpawnError e) {
stdout.printf ("Error: %s\n", e.message); stdout.printf ("Error: %s\n", e.message);
@ -59,6 +46,7 @@ namespace Pamac {
} }
} }
public MirrorsConfig (string path) { public MirrorsConfig (string path) {
conf_path = path; conf_path = path;
reload (); reload ();
@ -68,7 +56,6 @@ namespace Pamac {
// set default options // set default options
choosen_generation_method = "rank"; choosen_generation_method = "rank";
choosen_country = "ALL"; choosen_country = "ALL";
mirrorlists_dir = "/etc/pacman.d/mirrors";
parse_file (conf_path); parse_file (conf_path);
} }

View File

@ -102,8 +102,7 @@ namespace Pamac {
transaction.write_pamac_config_finished.connect (on_write_pamac_config_finished); transaction.write_pamac_config_finished.connect (on_write_pamac_config_finished);
AlpmPackage pkg = transaction.find_installed_satisfier ("pacman-mirrors"); AlpmPackage pkg = transaction.find_installed_satisfier ("pacman-mirrors");
AlpmPackage pkg_ml = transaction.find_installed_satisfier ("pacman-mirrorlist"); if (pkg.name == "") {
if (pkg.name == "" || pkg_ml.name == "") {
mirrors_config_box.visible = false; mirrors_config_box.visible = false;
} else { } else {
var mirrors_config = new MirrorsConfig ("/etc/pacman-mirrors.conf"); var mirrors_config = new MirrorsConfig ("/etc/pacman-mirrors.conf");