[gnome-software] Only show the scary firmware warning for removable devices



commit 00813d330674719666944296630b2d4e5426e4dd
Author: Richard Hughes <richard hughsie com>
Date:   Tue Dec 20 15:48:21 2016 +0000

    Only show the scary firmware warning for removable devices

 src/gs-app-row.c              |    2 +-
 src/gs-app.c                  |    2 ++
 src/gs-app.h                  |    1 +
 src/plugins/gs-plugin-fwupd.c |    4 ++++
 4 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/gs-app-row.c b/src/gs-app-row.c
index 9471c28..afa973a 100644
--- a/src/gs-app-row.c
+++ b/src/gs-app-row.c
@@ -322,7 +322,7 @@ gs_app_row_refresh (GsAppRow *app_row)
        }
 
        /* add warning */
-       if (gs_app_get_kind (priv->app) == AS_APP_KIND_FIRMWARE) {
+       if (gs_app_has_quirk (priv->app, AS_APP_QUIRK_REMOVABLE_HARDWARE)) {
                gtk_label_set_text (GTK_LABEL (priv->label_warning),
                                    /* TRANSLATORS: during the update the device
                                     * will restart into a special update-only mode */
diff --git a/src/gs-app.c b/src/gs-app.c
index d2e51b7..688c37b 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -198,6 +198,8 @@ _as_app_quirk_flag_to_string (AsAppQuirk quirk)
                return "needs-user-action";
        if (quirk == AS_APP_QUIRK_IS_PROXY)
                return "is-proxy";
+       if (quirk == AS_APP_QUIRK_REMOVABLE_HARDWARE)
+               return "removable-hardware";
        return NULL;
 }
 
diff --git a/src/gs-app.h b/src/gs-app.h
index a39c1d4..a0523f3 100644
--- a/src/gs-app.h
+++ b/src/gs-app.h
@@ -99,6 +99,7 @@ typedef enum {
 
 #if !AS_CHECK_VERSION(0,6,6)
 #define AS_APP_QUIRK_IS_PROXY                  (1 << 9)
+#define AS_APP_QUIRK_REMOVABLE_HARDWARE                (1 << 10)
 #endif
 
 GsApp          *gs_app_new                     (const gchar    *id);
diff --git a/src/plugins/gs-plugin-fwupd.c b/src/plugins/gs-plugin-fwupd.c
index 7625a8a..7da8768 100644
--- a/src/plugins/gs-plugin-fwupd.c
+++ b/src/plugins/gs-plugin-fwupd.c
@@ -374,6 +374,10 @@ gs_plugin_fwupd_new_app_from_results (GsPlugin *plugin, FwupdResult *res)
        if ((flags & FU_DEVICE_FLAG_ALLOW_ONLINE) == 0)
                gs_app_add_quirk (app, AS_APP_QUIRK_NEEDS_REBOOT);
 
+       /* is removable */
+       if ((flags & FU_DEVICE_FLAG_INTERNAL) == 0)
+               gs_app_add_quirk (app, AS_APP_QUIRK_REMOVABLE_HARDWARE);
+
        /* create icon */
        icon = as_icon_new ();
        as_icon_set_kind (icon, AS_ICON_KIND_STOCK);


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