diff --git a/sulfur/gfx/packages/package-installed-outdated-security.png b/sulfur/gfx/packages/package-installed-outdated-security.png new file mode 100644 index 000000000..e7ed4d08d Binary files /dev/null and b/sulfur/gfx/packages/package-installed-outdated-security.png differ diff --git a/sulfur/src/sulfur/event.py b/sulfur/src/sulfur/event.py index 39a105bc7..2fcf1bd44 100644 --- a/sulfur/src/sulfur/event.py +++ b/sulfur/src/sulfur/event.py @@ -35,5 +35,7 @@ gobject.signal_new("pkg_properties__ugc_tab_clicked", _SulfurSignals, gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ()) gobject.signal_new("updates_available", _SulfurSignals, gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (int,)) +gobject.signal_new("security_updates_available", _SulfurSignals, + gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (int,)) SulfurSignals = _SulfurSignals() diff --git a/sulfur/src/sulfur/package.py b/sulfur/src/sulfur/package.py index fc1f210d2..378f266cb 100644 --- a/sulfur/src/sulfur/package.py +++ b/sulfur/src/sulfur/package.py @@ -50,6 +50,7 @@ class DummyEntropyPackage: self.set_remove_incomplete = False self.is_downgrade = False self.is_group = False + self.security_update = False class EntropyPackage: @@ -77,6 +78,7 @@ class EntropyPackage: self.set_remove_incomplete = False self.is_downgrade = False self.is_group = False + self.security_update = False # might lead to memleaks self.__cache = {} diff --git a/sulfur/src/sulfur/packages.py b/sulfur/src/sulfur/packages.py index f5b97f604..68e611631 100644 --- a/sulfur/src/sulfur/packages.py +++ b/sulfur/src/sulfur/packages.py @@ -753,7 +753,17 @@ class EntropyPackages: def _pkg_get_updates_raw(self): return self._pkg_get_updates(critical_updates = False) - def _pkg_get_updates(self, critical_updates = True, orphans = False): + def _pkg_get_security_updates(self): + return self._pkg_get_updates(critical_updates = False, + security_updates = True) + + def _pkg_get_updates(self, critical_updates = True, orphans = False, + security_updates = False): + + if not security_updates: + # preload security updates so that .security_update bit is + # properly set, of course, don't fuck remove this :-) + self.get_raw_groups("security_updates") gp_call = self.get_package_item cdb_atomMatch = self.Entropy.installed_repository().atomMatch @@ -769,12 +779,20 @@ class EntropyPackages: yp.installed_match = installed_match yp.action = 'u' yp.color = SulfurConf.color_update + if security_updates: + yp.security_update = True return yp try: - updates, remove, fine, spm_fine = \ - self.Entropy.calculate_updates( - critical_updates = critical_updates) + if security_updates: + remove = [] + fine = [] + spm_fine = [] + updates = self.Entropy.calculate_security_updates() + else: + updates, remove, fine, spm_fine = \ + self.Entropy.calculate_updates( + critical_updates = critical_updates) except SystemDatabaseError: # broken client db return [] @@ -790,7 +808,10 @@ class EntropyPackages: pkg_updates.append(pkg) # emit signal about updates available - SulfurSignals.emit("updates_available", len(pkg_updates)) + if security_updates: + SulfurSignals.emit("security_updates_available", len(pkg_updates)) + else: + SulfurSignals.emit("updates_available", len(pkg_updates)) return pkg_updates @@ -1110,6 +1131,7 @@ class EntropyPackages: "loading": self._pkg_get_loading, "downgrade": self._pkg_get_downgrade, "glsa_metadata": self._pkg_get_glsa_metadata, + "security_updates": self._pkg_get_security_updates, "search": self._pkg_get_search, "all": self._pkg_get_all, } diff --git a/sulfur/src/sulfur/views.py b/sulfur/src/sulfur/views.py index 1f1e6de7e..26de62822 100644 --- a/sulfur/src/sulfur/views.py +++ b/sulfur/src/sulfur/views.py @@ -500,6 +500,8 @@ class EntropyPackageView: # default for installed packages self.pkg_install_ok = "package-installed-updated.png" self.pkg_install_updatable = "package-installed-outdated.png" + self.pkg_install_updatable_security = \ + "package-installed-outdated-security.png" self.pkg_install_new = "package-available.png" self.pkg_remove = "package-remove.png" self.pkg_purge = "package-purge.png" @@ -513,6 +515,9 @@ class EntropyPackageView: self.set_pixbuf_to_image(self.img_pkg_install_ok, self.pkg_install_ok) self.img_pkg_install_updatable = gtk.Image() self.set_pixbuf_to_image(self.img_pkg_install_updatable, self.pkg_install_updatable) + self.img_pkg_install_updatable_sec = gtk.Image() + self.set_pixbuf_to_image(self.img_pkg_install_updatable_sec, + self.pkg_install_updatable_security) self.img_pkg_update = gtk.Image() self.set_pixbuf_to_image(self.img_pkg_update, self.pkg_update) self.img_pkg_downgrade = gtk.Image() @@ -2187,7 +2192,12 @@ class EntropyPackageView: self.__install_statuses[pkg.matched_atom] = inst_status if inst_status is 2: - self.set_pixbuf_to_cell(cell, self.pkg_install_updatable) + if pkg.security_update: + self.set_pixbuf_to_cell(cell, + self.pkg_install_updatable_security) + else: + self.set_pixbuf_to_cell(cell, + self.pkg_install_updatable) else: self.set_pixbuf_to_cell(cell, self.pkg_install_ok) @@ -2196,7 +2206,12 @@ class EntropyPackageView: elif pkg.action == "d": self.set_pixbuf_to_cell(cell, self.pkg_downgrade) else: - self.set_pixbuf_to_cell(cell, self.pkg_install_updatable) + if pkg.security_update: + self.set_pixbuf_to_cell(cell, + self.pkg_install_updatable_security) + else: + self.set_pixbuf_to_cell(cell, + self.pkg_install_updatable) else: @@ -2232,7 +2247,9 @@ class EntropyPackageView: syspkg = obj.syspkg except: syspkg = False - if syspkg: + if obj.security_update: + cell.set_property(stype, '#FFEBCA') + elif syspkg: cell.set_property(stype, '#FFECEC') else: cell.set_property(stype, None)