diff --git a/src/system_daemon.vala b/src/system_daemon.vala index 61e27b6ce7b5cd9db8e5416f9911a3d0c03b3750..6c1d3479177d8579d641658f632e96164b189e50 100644 --- a/src/system_daemon.vala +++ b/src/system_daemon.vala @@ -246,26 +246,6 @@ namespace Pamac { return true; } - public string[] get_mirrors_countries () { - string[] countries = {}; - try { - string countries_str; - int status; - Process.spawn_command_line_sync ("pacman-mirrors -lq", - out countries_str, - null, - out status); - if (status == 0) { - foreach (unowned string country in countries_str.split ("\n")) { - countries += country; - } - } - } catch (SpawnError e) { - stderr.printf ("Error: %s\n", e.message); - } - return countries; - } - public bool get_lock (GLib.BusName sender) { if (lock_id == sender) { return true; @@ -369,7 +349,7 @@ namespace Pamac { private void generate_mirrors_list () { try { var process = new Subprocess.newv ( - {"pacman-mirrors", "-g"}, + {"pacman-mirrors", "-f", "0"}, SubprocessFlags.STDOUT_PIPE | SubprocessFlags.STDERR_MERGE); var dis = new DataInputStream (process.get_stdout_pipe ()); string? line; diff --git a/src/transaction.vala b/src/transaction.vala index f6df4ab80b8c60288937e13e82af2c7d184ce292..0164b2bc639ef966b58412f3018f771787d50b14 100644 --- a/src/transaction.vala +++ b/src/transaction.vala @@ -21,6 +21,7 @@ namespace Pamac { [DBus (name = "org.manjaro.pamac.user")] interface UserDaemon : Object { public abstract void refresh_handle () throws IOError; + public abstract string[] get_mirrors_countries () throws IOError; public abstract string get_lockfile () throws IOError; public abstract AlpmPackage get_installed_pkg (string pkgname) throws IOError; public abstract bool get_checkspace () throws IOError; @@ -55,7 +56,6 @@ namespace Pamac { [DBus (name = "org.manjaro.pamac.system")] interface SystemDaemon : Object { public abstract void set_environment_variables (HashTable<string,string> variables) throws IOError; - public abstract string[] get_mirrors_countries () throws IOError; public abstract ErrorInfos get_current_error () throws IOError; public abstract bool get_lock () throws IOError; public abstract bool unlock () throws IOError; @@ -271,9 +271,8 @@ namespace Pamac { public string[] get_mirrors_countries () { string[] countries = {}; - connecting_system_daemon (); try { - countries = system_daemon.get_mirrors_countries (); + countries = user_daemon.get_mirrors_countries (); } catch (IOError e) { stderr.printf ("IOError: %s\n", e.message); } diff --git a/src/user_daemon.vala b/src/user_daemon.vala index d69c9f70ec0eae74a211c7f0cc1ef5e1188ec354..a0f8aa2bf78d4b88a1529e35567eb434e097eb5e 100644 --- a/src/user_daemon.vala +++ b/src/user_daemon.vala @@ -139,6 +139,26 @@ namespace Pamac { aur_updates_checked = false; } + public string[] get_mirrors_countries () { + string[] countries = {}; + try { + string countries_str; + int status; + Process.spawn_command_line_sync ("pacman-mirrors -lq", + out countries_str, + null, + out status); + if (status == 0) { + foreach (unowned string country in countries_str.split ("\n")) { + countries += country; + } + } + } catch (SpawnError e) { + stderr.printf ("Error: %s\n", e.message); + } + return countries; + } + public bool get_checkspace () { return alpm_handle.checkspace == 1 ? true : false; }