Skip to content

Commit

Permalink
SystemUpdate: alter notifications for security updates (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit authored Jan 28, 2024
1 parent dc3ee28 commit 350f76c
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/Backends/SystemUpdate.vala
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,15 @@ public class SettingsDaemon.Backends.SystemUpdate : Object {

string[] package_names = {};
Pk.Info[] package_info = {};
bool security_updates = false;

foreach (var package in available_updates.get_array ()) {
package_names += package.get_name ();
package_info += package.get_info ();

if (package.get_info () == SECURITY) {
security_updates = true;
}
}

update_details = {
Expand All @@ -117,10 +122,17 @@ public class SettingsDaemon.Backends.SystemUpdate : Object {

if (notify) {
var notification = new Notification (_("Update available"));
notification.set_body (_("A system update is available"));
notification.set_icon (new ThemedIcon ("software-update-available"));
notification.set_default_action (Application.ACTION_PREFIX + Application.SHOW_UPDATES_ACTION);

if (security_updates) {
notification.set_body (_("A system security update is available"));
notification.set_icon (new ThemedIcon ("software-update-urgent"));
notification.set_priority (HIGH);
} else {
notification.set_body (_("A system update is available"));
notification.set_icon (new ThemedIcon ("software-update-available"));
}

GLib.Application.get_default ().send_notification (NOTIFICATION_ID, notification);
}

Expand Down

0 comments on commit 350f76c

Please sign in to comment.