From f8d30c03acd2c8be5df52acd3035045ddddabbfe Mon Sep 17 00:00:00 2001 From: guinux Date: Sat, 26 Oct 2013 12:43:44 +0200 Subject: [PATCH] do not allow to reinstall a package if can be updated --- pamac-daemon.py | 8 +++----- pamac-manager.py | 11 ++++++----- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/pamac-daemon.py b/pamac-daemon.py index 64bf946..b535b63 100755 --- a/pamac-daemon.py +++ b/pamac-daemon.py @@ -367,20 +367,18 @@ class PamacDBusService(dbus.service.Object): def CheckUpdates(self): updates = 0 - _ignorepkgs = [] + _ignorepkgs = set() for group in self.handle.ignoregrps: db = self.handle.get_localdb() grp = db.read_grp(group) if grp: name, pkg_list = grp for pkg in pkg_list: - if not pkg.name in _ignorepkgs: - _ignorepkgs.append(pkg.name) + _ignorepkgs.add(pkg.name) for name in self.handle.ignorepkgs: pkg = self.handle.get_localdb().get_pkg(name) if pkg: - if not pkg.name in _ignorepkgs: - _ignorepkgs.append(pkg.name) + _ignorepkgs.add(pkg.name) if config.syncfirst: for name in config.syncfirst: pkg = self.handle.get_localdb().get_pkg(name) diff --git a/pamac-manager.py b/pamac-manager.py index df8baba..a4e5a3a 100755 --- a/pamac-manager.py +++ b/pamac-manager.py @@ -492,11 +492,12 @@ def on_list_treeview_button_press_event(treeview, event): item.connect('activate', mark_to_remove, liststore[treeiter][0]) right_click_menu.append(item) if transaction.get_syncpkg(liststore[treeiter][0].name): - item = Gtk.ImageMenuItem(_('Reinstall')) - item.set_image(Gtk.Image.new_from_pixbuf(to_reinstall_icon)) - item.set_always_show_image(True) - item.connect('activate', mark_to_reinstall, liststore[treeiter][0]) - right_click_menu.append(item) + if not pyalpm.sync_newversion(liststore[treeiter][0], transaction.syncdbs): + item = Gtk.ImageMenuItem(_('Reinstall')) + item.set_image(Gtk.Image.new_from_pixbuf(to_reinstall_icon)) + item.set_always_show_image(True) + item.connect('activate', mark_to_reinstall, liststore[treeiter][0]) + right_click_menu.append(item) optdeps_strings = liststore[treeiter][0].optdepends if optdeps_strings: available_optdeps = []