fix #227, enable AUR package reinstall

This commit is contained in:
guinux 2017-03-18 10:16:31 +01:00
parent c222506fdf
commit e16edcb02a
2 changed files with 19 additions and 2 deletions

View File

@ -1818,7 +1818,6 @@ namespace Pamac {
trans_commit_finished (false);
} else {
alpm_handle.questioncb = (Alpm.QuestionCallBack) cb_question;
alpm_handle.logcb = (Alpm.LogCallBack) cb_log;
lockfile = GLib.File.new_for_path (alpm_handle.lockfile);
// fake aur db
alpm_handle.register_syncdb ("aur", 0);

View File

@ -519,12 +519,23 @@ namespace Pamac {
install_togglebutton.visible = false;
remove_togglebutton.visible = true;
remove_togglebutton.active = transaction.to_remove.contains (details.name);
reinstall_togglebutton.visible = false;
AlpmPackage find_pkg = transaction.get_sync_pkg (details.name);
if (find_pkg.name != "") {
if (find_pkg.version == details.version) {
reinstall_togglebutton.visible = true;
reinstall_togglebutton.active = transaction.to_install.contains (details.name);
}
} else {
transaction.get_aur_details.begin (details.name, (obj, res) => {
AURPackageDetails aur_details = transaction.get_aur_details.end (res);
if (aur_details.name != "") {
if (aur_details.version == details.version) {
reinstall_togglebutton.visible = true;
reinstall_togglebutton.active = transaction.to_build.contains (details.name);
}
}
});
}
} else if (details.origin == 3) { //Alpm.Package.From.SYNCDB
remove_togglebutton.visible = false;
@ -777,10 +788,17 @@ namespace Pamac {
remove_togglebutton.get_style_context ().remove_class (Gtk.STYLE_CLASS_DESTRUCTIVE_ACTION);
reinstall_togglebutton.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION);
transaction.to_remove.remove (current_package_displayed);
transaction.to_install.add (current_package_displayed);
AlpmPackage find_pkg = transaction.get_sync_pkg (current_package_displayed);
if (find_pkg.name != "") {
transaction.to_install.add (current_package_displayed);
} else {
// availability in AUR was checked in set_package_details
transaction.to_build.add (current_package_displayed);
}
} else {
reinstall_togglebutton.get_style_context ().remove_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION);
transaction.to_install.remove (current_package_displayed);
transaction.to_build.remove (current_package_displayed);
}
set_pendings_operations ();
}