Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 8725 - Tray Update Notifier fix for os-eol feature change #201

Merged
merged 1 commit into from
Jun 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 22 additions & 10 deletions qui/tray/updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ def connect_events(self):
self.feature_unset)
self.dispatcher.add_handler('domain-add', self.domain_added)
self.dispatcher.add_handler('domain-delete', self.domain_removed)
self.dispatcher.add_handler('domain-feature-set:os-eol',
self.feature_set)

def domain_added(self, _submitter, _event, vm, *_args, **_kwargs):
try:
Expand Down Expand Up @@ -177,16 +179,26 @@ def feature_unset(self, vm, event, feature, **_kwargs):

def feature_set(self, vm, event, feature, value, **_kwargs):
# pylint: disable=unused-argument
if value and vm not in self.vms_needing_update and\
getattr(vm, 'updateable', False):
self.vms_needing_update.add(vm)

notification = Gio.Notification.new(
_("New updates are available for {}.").format(vm.name))
notification.set_priority(Gio.NotificationPriority.NORMAL)
self.send_notification(None, notification)
elif not value and vm in self.vms_needing_update:
self.vms_needing_update.remove(vm)
if feature == 'updates-available':
if value and vm not in self.vms_needing_update and\
getattr(vm, 'updateable', False):
self.vms_needing_update.add(vm)

notification = Gio.Notification.new(
_("New updates are available for {}.").format(vm.name))
notification.set_priority(Gio.NotificationPriority.NORMAL)
self.send_notification(None, notification)
elif not value and vm in self.vms_needing_update:
self.vms_needing_update.remove(vm)
elif feature == 'os-eol':
try:
supported = qui.utils.check_support(vm)
except exc.QubesDaemonCommunicationError:
supported = True
if supported and vm.name in self.obsolete_vms:
self.obsolete_vms.remove(vm.name)
elif not supported and vm.name not in self.obsolete_vms:
self.obsolete_vms.add(vm.name)

self.update_indicator_state()

Expand Down