Skip to content

Commit

Permalink
ExtensionCore: show the number of available updates in the 'Update al…
Browse files Browse the repository at this point in the history
…l' button tooltip (#7366)
  • Loading branch information
collinss authored and clefebvre committed Apr 20, 2018
1 parent 8c77370 commit 6ac295a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
Expand Up @@ -814,7 +814,6 @@ def __init__(self, parent, collection_type, spices, window):

self.update_all_button = Gtk.Button.new_from_icon_name("software-update-available-symbolic", Gtk.IconSize.MENU)
self.update_all_button.set_size_request(50, -1)
self.update_all_button.set_tooltip_text(_("Update all"))
self.update_all_button.connect('clicked', self.update_all)
box.add(self.update_all_button)
self.update_all_button.set_sensitive(False)
Expand Down Expand Up @@ -926,7 +925,13 @@ def build_list(self, *args):
self.extension_rows.append(row)
self.list_box.add(row)

self.update_all_button.set_sensitive(self.spices.are_updates_available())
updates_available = self.spices.get_n_updates()
self.update_all_button.set_sensitive(updates_available)
if updates_available > 0:
msg_text = _("Update all") + ' (' + ngettext("%d update available", "%d updates available", updates_available) % updates_available + ')'
else:
msg_text = _("No updates available")
self.update_all_button.set_tooltip_text(msg_text)
self.refresh_button.set_sensitive(True)

def get_more_info(self, *args):
Expand Down
4 changes: 4 additions & 0 deletions files/usr/share/cinnamon/cinnamon-settings/bin/Spices.py
Expand Up @@ -436,6 +436,10 @@ def get_is_running(self, uuid):
def are_updates_available(self):
return len(self.updates_available) > 0

""" returns the number of available updates"""
def get_n_updates(self):
return len(self.updates_available)

""" retrieves a copy of the index cache """
def get_cache(self):
return self.index_cache
Expand Down
Expand Up @@ -25,7 +25,7 @@
import SettingsWidgets

# i18n
gettext.install("cinnamon", "/usr/share/locale")
gettext.install("cinnamon", "/usr/share/locale", names="ngettext")

# Standard setting pages... this can be expanded to include applet dirs maybe?
mod_files = glob.glob(config.currentPath + "/modules/*.py")
Expand Down

0 comments on commit 6ac295a

Please sign in to comment.