[gnome-software/wip/hughsie/allow-overwrite] Allow the name, summary and description to be overwritten



commit 56fe15208978fbec8cd46df32072e67eeb3ccf86
Author: Richard Hughes <richard hughsie com>
Date:   Wed Jul 17 16:44:54 2019 +0100

    Allow the name, summary and description to be overwritten
    
    To use GsApp in other applications like gnome-software-editor we need to be able
    to overwrite the existing values, and that's not currently possible.
    
    Relax the checks as they were only supposed to prevent a LOW quality summary
    from PackageKit overwrite a HIGH quality summary from AppStream.

 lib/gs-app.c                    | 6 +++---
 plugins/fwupd/gs-plugin-fwupd.c | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/lib/gs-app.c b/lib/gs-app.c
index 5f3c4798..c4bae9af 100644
--- a/lib/gs-app.c
+++ b/lib/gs-app.c
@@ -1304,7 +1304,7 @@ gs_app_set_name (GsApp *app, GsAppQuality quality, const gchar *name)
        locker = g_mutex_locker_new (&priv->mutex);
 
        /* only save this if the data is sufficiently high quality */
-       if (quality <= priv->name_quality)
+       if (quality < priv->name_quality)
                return;
        priv->name_quality = quality;
        if (_g_set_str (&priv->name, name))
@@ -2086,7 +2086,7 @@ gs_app_set_summary (GsApp *app, GsAppQuality quality, const gchar *summary)
        locker = g_mutex_locker_new (&priv->mutex);
 
        /* only save this if the data is sufficiently high quality */
-       if (quality <= priv->summary_quality)
+       if (quality < priv->summary_quality)
                return;
        priv->summary_quality = quality;
        if (_g_set_str (&priv->summary, summary))
@@ -2131,7 +2131,7 @@ gs_app_set_description (GsApp *app, GsAppQuality quality, const gchar *descripti
        locker = g_mutex_locker_new (&priv->mutex);
 
        /* only save this if the data is sufficiently high quality */
-       if (quality <= priv->description_quality)
+       if (quality < priv->description_quality)
                return;
        priv->description_quality = quality;
        _g_set_str (&priv->description, description);
diff --git a/plugins/fwupd/gs-plugin-fwupd.c b/plugins/fwupd/gs-plugin-fwupd.c
index 8d4961e9..1502e718 100644
--- a/plugins/fwupd/gs-plugin-fwupd.c
+++ b/plugins/fwupd/gs-plugin-fwupd.c
@@ -1003,9 +1003,9 @@ gs_plugin_file_to_app (GsPlugin *plugin,
                /* create each app */
                app = gs_plugin_fwupd_new_app_from_device (plugin, dev);
 
-               /* we have no update view for local files */
+               /* we *might* have no update view for local files */
                gs_app_set_version (app, gs_app_get_update_version (app));
-               gs_app_set_description (app, GS_APP_QUALITY_NORMAL,
+               gs_app_set_description (app, GS_APP_QUALITY_LOWEST,
                                        gs_app_get_update_details (app));
                gs_app_list_add (list, app);
        }


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