save cache options in pamac.conf

This commit is contained in:
guinux
2017-09-22 11:03:37 +02:00
parent 9d138d0447
commit 20e42b6a75
10 changed files with 111 additions and 9 deletions

View File

@@ -28,6 +28,8 @@ namespace Pamac {
public bool enable_aur { get; private set; }
public string aur_build_dir { get; private set; }
public bool check_aur_updates { get; private set; }
public uint64 keep_num_pkgs { get; private set; }
public bool rm_only_uninstalled { get; private set; }
public unowned HashTable<string,string> environment_variables {
get {
return _environment_variables;
@@ -72,6 +74,8 @@ namespace Pamac {
enable_aur = false;
aur_build_dir = "/tmp";
check_aur_updates = false;
keep_num_pkgs = 3;
rm_only_uninstalled = false;
parse_file (conf_path);
}
@@ -103,6 +107,13 @@ namespace Pamac {
unowned string val = splitted[1]._strip ();
refresh_period = uint64.parse (val);
}
} else if (key == "KeepNumPackages") {
if (splitted.length == 2) {
unowned string val = splitted[1]._strip ();
keep_num_pkgs = uint64.parse (val);
}
} else if (key == "OnlyRmUninstalled") {
rm_only_uninstalled = true;
} else if (key == "NoUpdateHideIcon") {
no_update_hide_icon = true;
} else if (key == "EnableAUR") {
@@ -157,6 +168,24 @@ namespace Pamac {
} else {
data.append (line + "\n");
}
} else if (line.contains ("KeepNumPackages")) {
if (new_conf.lookup_extended ("KeepNumPackages", null, out variant)) {
data.append ("KeepNumPackages = %llu\n".printf (variant.get_uint64 ()));
new_conf.remove ("KeepNumPackages");
} else {
data.append (line + "\n");
}
} else if (line.contains ("OnlyRmUninstalled")) {
if (new_conf.lookup_extended ("OnlyRmUninstalled", null, out variant)) {
if (variant.get_boolean ()) {
data.append ("OnlyRmUninstalled\n");
} else {
data.append ("#OnlyRmUninstalled\n");
}
new_conf.remove ("OnlyRmUninstalled");
} else {
data.append (line + "\n");
}
} else if (line.contains ("NoUpdateHideIcon")) {
if (new_conf.lookup_extended ("NoUpdateHideIcon", null, out variant)) {
if (variant.get_boolean ()) {
@@ -224,6 +253,14 @@ namespace Pamac {
}
} else if (key == "RefreshPeriod") {
data.append ("RefreshPeriod = %llu\n".printf (val.get_uint64 ()));
} else if (key == "KeepNumPackages") {
data.append ("KeepNumPackages = %llu\n".printf (val.get_uint64 ()));
} else if (key == "OnlyRmUninstalled") {
if (val.get_boolean ()) {
data.append ("OnlyRmUninstalled\n");
} else {
data.append ("#OnlyRmUninstalled\n");
}
} else if (key =="NoUpdateHideIcon") {
if (val.get_boolean ()) {
data.append ("NoUpdateHideIcon\n");