Merge pull request #157 from scachemaille/issue_155

Fix Issue 155
This commit is contained in:
guinux 2016-08-24 16:59:40 +02:00 committed by GitHub
commit 811377ed49
2 changed files with 12 additions and 4 deletions

View File

@ -53,7 +53,7 @@ namespace Pamac {
public void reload () { public void reload () {
// set default options // set default options
choosen_generation_method = "rank"; choosen_generation_method = "rank";
choosen_country = dgettext (null, "Worldwide"); choosen_country = "ALL";
mirrorlists_dir = "/etc/pacman.d/mirrors"; mirrorlists_dir = "/etc/pacman.d/mirrors";
parse_file (conf_path); parse_file (conf_path);
} }
@ -123,7 +123,7 @@ namespace Pamac {
} }
} else if (line.contains ("OnlyCountry")) { } else if (line.contains ("OnlyCountry")) {
if (new_conf.lookup_extended ("OnlyCountry", null, out variant)) { if (new_conf.lookup_extended ("OnlyCountry", null, out variant)) {
if (variant.get_string () == dgettext (null, "Worldwide")) { if (variant.get_string () == "ALL") {
data.append ("#%s\n".printf (line)); data.append ("#%s\n".printf (line));
} else { } else {
data.append ("OnlyCountry=%s\n".printf (variant.get_string ())); data.append ("OnlyCountry=%s\n".printf (variant.get_string ()));

View File

@ -321,7 +321,11 @@ namespace Pamac {
void on_mirrors_country_comboboxtext_changed () { void on_mirrors_country_comboboxtext_changed () {
var new_mirrors_conf = new HashTable<string,Variant> (str_hash, str_equal); var new_mirrors_conf = new HashTable<string,Variant> (str_hash, str_equal);
new_mirrors_conf.insert ("OnlyCountry", new Variant.string (mirrors_country_comboboxtext.get_active_text ())); var mirror_country = mirrors_country_comboboxtext.get_active_text ();
if (mirror_country == dgettext (null, "Worldwide")) {
mirror_country = "ALL";
}
new_mirrors_conf.insert ("OnlyCountry", new Variant.string (mirror_country) );
transaction.start_write_mirrors_config (new_mirrors_conf); transaction.start_write_mirrors_config (new_mirrors_conf);
} }
@ -337,10 +341,14 @@ namespace Pamac {
void on_write_mirrors_config_finished (string choosen_country, string choosen_generation_method) { void on_write_mirrors_config_finished (string choosen_country, string choosen_generation_method) {
int index = 0; int index = 0;
string choosen_country_ = dgettext (null, "Worldwide");
if (choosen_country != "ALL") {
choosen_country_ = choosen_country;
}
mirrors_country_comboboxtext.model.foreach ((model, path, iter) => { mirrors_country_comboboxtext.model.foreach ((model, path, iter) => {
GLib.Value country; GLib.Value country;
model.get_value (iter, 0, out country); model.get_value (iter, 0, out country);
if ((string) country == choosen_country) { if ((string) country == choosen_country_) {
return true; return true;
} }
index += 1; index += 1;