[gnome-software/wip/kalev/require-distro-upgrade-artwork] Don't offer Fedora distro upgrades if we don't have correct artwork



commit 57e0505842356b94d02e3c60481fc398cdd9ba56
Author: Kalev Lember <klember redhat com>
Date:   Mon May 4 14:08:08 2020 +0200

    Don't offer Fedora distro upgrades if we don't have correct artwork
    
    Make sure we have the artwork for the distro upgrade banner before
    offering an upgrade. In practice, this means that we don't offer a
    distro upgrade at all unless the user has first updated gnome-software
    to the version available from in the updates repo.
    
    This comes with a slight tradeoff that some people who never install
    regular updates will not get the distro upgrade notification at all
    after this change.

 .../gs-plugin-fedora-pkgdb-collections.c                       | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/plugins/fedora-pkgdb-collections/gs-plugin-fedora-pkgdb-collections.c 
b/plugins/fedora-pkgdb-collections/gs-plugin-fedora-pkgdb-collections.c
index 2e6486c4..641b717a 100644
--- a/plugins/fedora-pkgdb-collections/gs-plugin-fedora-pkgdb-collections.c
+++ b/plugins/fedora-pkgdb-collections/gs-plugin-fedora-pkgdb-collections.c
@@ -248,6 +248,7 @@ _sort_items_cb (gconstpointer a, gconstpointer b)
 static GsApp *
 _create_upgrade_from_info (GsPlugin *plugin, PkgdbItem *item)
 {
+       GsPluginData *priv = gs_plugin_get_data (plugin);
        GsApp *app;
        g_autofree gchar *app_id = NULL;
        g_autofree gchar *app_version = NULL;
@@ -294,9 +295,14 @@ _create_upgrade_from_info (GsPlugin *plugin, PkgdbItem *item)
                               item->version);
        gs_app_set_url (app, AS_URL_KIND_HOMEPAGE, url);
 
-       /* use a fancy background if possible */
        background = _get_upgrade_css_background (item->version);
-       if (background != NULL) {
+       if (background == NULL) {
+               /* require fancy background for upgrades, except for when
+                * testing pre-releases with show-upgrade-prerelease key set */
+               if (!g_settings_get_boolean (priv->settings, "show-upgrade-prerelease"))
+                       return NULL;
+       } else {
+               /* use a fancy background */
                css = g_strdup_printf ("background: %s;"
                                       "background-position: top;"
                                       "background-size: cover;"


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