Skip to content

Commit

Permalink
Count all available updates in systray status
Browse files Browse the repository at this point in the history
  • Loading branch information
clefebvre committed Jun 28, 2017
1 parent a4b834c commit 0953b8d
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions usr/lib/linuxmint/mintUpdate/mintUpdate.py
Expand Up @@ -636,7 +636,7 @@ def run(self):

# Look at the updates one by one
num_visible = 0
num_safe = 0
num_checked = 0
download_size = 0

if (len(lines) == None):
Expand Down Expand Up @@ -684,7 +684,7 @@ def run(self):
iter = model.insert_before(None, None)
if safe:
model.set_value(iter, UPDATE_CHECKED, "true")
num_safe = num_safe + 1
num_checked = num_checked + 1
download_size = download_size + update.size
else:
model.set_value(iter, UPDATE_CHECKED, "false")
Expand Down Expand Up @@ -741,18 +741,26 @@ def run(self):
num_visible = num_visible + 1

Gdk.threads_enter()
if (num_safe > 0):
if (num_safe == 1):
self.statusString = _("1 recommended update available (%(size)s)") % {'size':size_to_string(download_size)}
else:
self.statusString = _("%(recommended)d recommended updates available (%(size)s)") % {'recommended':num_safe, 'size':size_to_string(download_size)}
self.application.set_status(self.statusString, self.statusString, "mintupdate-updates-available", True)
self.application.logger.write("Found " + str(num_safe) + " recommended software updates")
else:
if num_visible == 0:
self.application.stack.set_visible_child_name("status_updated")
if (num_visible == 0):
self.application.stack.set_visible_child_name("status_updated")
self.application.set_status(_("Your system is up to date"), _("Your system is up to date"), "mintupdate-up-to-date", not self.application.settings.get_boolean("hide-systray"))
self.application.logger.write("System is up to date")
else:
if (num_checked == 0):
self.statusString = _("No updates selected")
elif (num_checked == 1):
self.statusString = _("%(selected)d update selected (%(size)s)") % {'selected':num_checked, 'size':size_to_string(download_size)}
elif (num_checked > 1):
self.statusString = _("%(selected)d updates selected (%(size)s)") % {'selected':num_checked, 'size':size_to_string(download_size)}

self.application.set_status(self.statusString, self.statusString, "mintupdate-updates-available", True)
self.application.logger.write("Found " + str(num_visible) + " software updates")

if (num_visible == 1):
systrayString = _("%d update available") % num_visible
elif (num_visible > 1):
systrayString = _("%d updates available") % num_visible
self.application.statusIcon.set_tooltip_text(systrayString)

Gdk.threads_leave()

Expand Down

3 comments on commit 0953b8d

@pdev77
Copy link

@pdev77 pdev77 commented on 0953b8d Dec 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi

Whats the reasoning behind this commit? Having just taken Mint 18.3 and thought the system tray icon was now broken, I can see its down to this commit/change.
If you (as I did) have the following configuration:

Options:

  • Always Show Security Updates
  • Always Select Security Updates
    Levels:
    1,2,3 Visible, but NONE "Selected"

The icon would be 'i' / blue when security updates were available, but green the rest of the time.
With the above change, unless I apply every update I choose to be visible (but not selected) - the icon will be permanently blue - therefore I will not know when security updates are available - thereby reducing my awareness of patch availability.
Perhaps theres other scenarios that make the above commit positive - but to myself and some others on the mint forum - this change has 'broken' the update manager icon.

Note to others - if you copy the old version of "/usr/lib/linuxmint/mintUpdate/mintUpdate.py" from this repo (or from an 18.2 installation) it still works - and you can manually retain the old behavior.

@clefebvre
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change was made on purpose so that the icon would reflect what is visible as opposed to what is selected by default.

@pdev77
Copy link

@pdev77 pdev77 commented on 0953b8d Dec 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But for us who want to just ‘keep our computers safe’ & not install every single package update (but have them visible) – the update manager icon is now useless.
IIRC the behaviour was customisable before using the select checkboxes – this change has taken away that functionality. Can the behaviour not be left to the user to decide?

Please sign in to comment.