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



commit aadfe342a3d7591237bbb57e53d1b4c60122332f
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                  |    4 ++++
 src/plugins/gs-plugin-fwupd.c |    4 ++++
 4 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/src/gs-app-row.c b/src/gs-app-row.c
index 94629ea..c6cf4dc 100644
--- a/src/gs-app-row.c
+++ b/src/gs-app-row.c
@@ -319,7 +319,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 940771d..611fd4a 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -184,6 +184,8 @@ _as_app_quirk_flag_to_string (AsAppQuirk quirk)
                return "not-launchable";
        if (quirk == AS_APP_QUIRK_NEEDS_USER_ACTION)
                return "needs-user-action";
+       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 7324e18..9a9f262 100644
--- a/src/gs-app.h
+++ b/src/gs-app.h
@@ -97,6 +97,10 @@ typedef enum {
        GS_APP_QUALITY_LAST
 } GsAppQuality;
 
+#if !AS_CHECK_VERSION(0,6,6)
+#define AS_APP_QUIRK_REMOVABLE_HARDWARE                (1 << 10)
+#endif
+
 GsApp          *gs_app_new                     (const gchar    *id);
 GsApp          *gs_app_new_from_unique_id      (const gchar    *unique_id);
 gchar          *gs_app_to_string               (GsApp          *app);
diff --git a/src/plugins/gs-plugin-fwupd.c b/src/plugins/gs-plugin-fwupd.c
index 1b6e8de..efd800e 100644
--- a/src/plugins/gs-plugin-fwupd.c
+++ b/src/plugins/gs-plugin-fwupd.c
@@ -302,6 +302,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]