[gnome-software] Add a GSettings key for allowing upgrading to pre-release distro versions



commit 7d1bf2a9438a0ce5982ffb7090ed0a467cb3dd40
Author: Richard Hughes <richard hughsie com>
Date:   Tue Jun 28 09:50:11 2016 +0100

    Add a GSettings key for allowing upgrading to pre-release distro versions
    
    Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=765823

 data/org.gnome.software.gschema.xml            |    4 ++++
 src/plugins/gs-plugin-fedora-distro-upgrades.c |    8 ++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/data/org.gnome.software.gschema.xml b/data/org.gnome.software.gschema.xml
index 47c1cad..fb1b0e7 100644
--- a/data/org.gnome.software.gschema.xml
+++ b/data/org.gnome.software.gschema.xml
@@ -78,5 +78,9 @@
       <default>true</default>
       <summary>Allow access to the Software Sources dialog</summary>
     </key>
+    <key name="upgrade-allow-prerelease" type="b">
+      <default>false</default>
+      <summary>Offer upgrades for pre-releases</summary>
+    </key>
   </schema>
 </schemalist>
diff --git a/src/plugins/gs-plugin-fedora-distro-upgrades.c b/src/plugins/gs-plugin-fedora-distro-upgrades.c
index 8a3aca3..d9905af 100644
--- a/src/plugins/gs-plugin-fedora-distro-upgrades.c
+++ b/src/plugins/gs-plugin-fedora-distro-upgrades.c
@@ -310,6 +310,7 @@ gs_plugin_add_distro_upgrades (GsPlugin *plugin,
        guint i;
        g_autofree gchar *data = NULL;
        g_autoptr(GPtrArray) distros = NULL;
+       g_autoptr(GSettings) settings = NULL;
 
        /* just ensure there is any data, no matter how old */
        if (!gs_plugin_fedora_distro_upgrades_refresh (plugin,
@@ -323,6 +324,7 @@ gs_plugin_add_distro_upgrades (GsPlugin *plugin,
                return FALSE;
 
        /* parse data */
+       settings = g_settings_new ("org.gnome.software");
        distros = parse_pkgdb_collections_data (data, len, error);
        if (distros == NULL)
                return FALSE;
@@ -346,8 +348,10 @@ gs_plugin_add_distro_upgrades (GsPlugin *plugin,
                        continue;
 
                /* only interested in non-devel distros */
-               if (distro_info->status == DISTRO_STATUS_DEVEL)
-                       continue;
+               if (!g_settings_get_boolean (settings, "upgrade-allow-prerelease")) {
+                       if (distro_info->status != DISTRO_STATUS_ACTIVE)
+                               continue;
+               }
 
                /* search in the cache */
                cache_key = g_strdup_printf ("release-%d", distro_info->version);


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