[gnome-software: 1/2] fwupd: Annotate updates with their release urgency




commit b4e38cb7272dd8b758e76d884c8023c4bf0975b3
Author: Philip Withnall <pwithnall endlessos org>
Date:   Wed Oct 19 09:59:59 2022 +0100

    fwupd: Annotate updates with their release urgency
    
    This should cause security-sensitive firmware updates to be given a
    higher priority and notified to the user more quickly.
    
    See https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1943#note_1577354
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 plugins/fwupd/gs-fwupd-app.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
---
diff --git a/plugins/fwupd/gs-fwupd-app.c b/plugins/fwupd/gs-fwupd-app.c
index 7fcbdadab..c27f5a573 100644
--- a/plugins/fwupd/gs-fwupd-app.c
+++ b/plugins/fwupd/gs-fwupd-app.c
@@ -235,6 +235,24 @@ gs_fwupd_release_get_name (FwupdRelease *release)
        return g_strdup (name);
 }
 
+static AsUrgencyKind
+gs_fwupd_release_urgency_to_as_urgency_kind (FwupdReleaseUrgency urgency)
+{
+       switch (urgency) {
+       case FWUPD_RELEASE_URGENCY_LOW:
+               return AS_URGENCY_KIND_LOW;
+       case FWUPD_RELEASE_URGENCY_MEDIUM:
+               return AS_URGENCY_KIND_MEDIUM;
+       case FWUPD_RELEASE_URGENCY_HIGH:
+               return AS_URGENCY_KIND_HIGH;
+       case FWUPD_RELEASE_URGENCY_CRITICAL:
+               return AS_URGENCY_KIND_CRITICAL;
+       case FWUPD_RELEASE_URGENCY_UNKNOWN:
+       default:
+               return AS_URGENCY_KIND_UNKNOWN;
+       }
+}
+
 void
 gs_fwupd_app_set_from_release (GsApp *app, FwupdRelease *rel)
 {
@@ -286,4 +304,6 @@ gs_fwupd_app_set_from_release (GsApp *app, FwupdRelease *rel)
                        as_screenshot_set_caption (ss, fwupd_release_get_detach_caption (rel), NULL);
                gs_app_set_action_screenshot (app, ss);
        }
+
+       gs_app_set_update_urgency (app, gs_fwupd_release_urgency_to_as_urgency_kind 
(fwupd_release_get_urgency (rel)));
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]