From e16edcb02aa1e0c4f57ad3de0e3e8e9addbec2c8 Mon Sep 17 00:00:00 2001 From: guinux Date: Sat, 18 Mar 2017 10:16:31 +0100 Subject: [PATCH] fix #227, enable AUR package reinstall --- src/daemon.vala | 1 - src/manager_window.vala | 20 +++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/daemon.vala b/src/daemon.vala index 26eb5d5..bedb804 100644 --- a/src/daemon.vala +++ b/src/daemon.vala @@ -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); diff --git a/src/manager_window.vala b/src/manager_window.vala index 9b29702..74c1651 100644 --- a/src/manager_window.vala +++ b/src/manager_window.vala @@ -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 (); }