[gnome-software/gnome-3-20] Ensure there is upgrade data when getting the list of distribution upgrades



commit a9305a0290577dc846ca24adf4ec0514c695fa8e
Author: Richard Hughes <richard hughsie com>
Date:   Wed Apr 20 14:22:25 2016 +0100

    Ensure there is upgrade data when getting the list of distribution upgrades
    
    This allows the end user to just open the updates panel to download the initial
    list of distro upgrades rather than waiting for a refresh or manually
    downloading all the pending updates.

 src/plugins/gs-plugin-fedora-distro-upgrades.c |   52 +++++++++++++++++++-----
 1 files changed, 41 insertions(+), 11 deletions(-)
---
diff --git a/src/plugins/gs-plugin-fedora-distro-upgrades.c b/src/plugins/gs-plugin-fedora-distro-upgrades.c
index a6d9b03..8291d40 100644
--- a/src/plugins/gs-plugin-fedora-distro-upgrades.c
+++ b/src/plugins/gs-plugin-fedora-distro-upgrades.c
@@ -108,19 +108,14 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
 }
 
 /**
- * gs_plugin_refresh:
+ * gs_plugin_fedora_distro_upgrades_refresh:
  */
-gboolean
-gs_plugin_refresh (GsPlugin *plugin,
-                  guint cache_age,
-                  GsPluginRefreshFlags flags,
-                  GCancellable *cancellable,
-                  GError **error)
+static gboolean
+gs_plugin_fedora_distro_upgrades_refresh (GsPlugin *plugin,
+                                         guint cache_age,
+                                         GCancellable *cancellable,
+                                         GError **error)
 {
-       /* only for update metadata, no stored state other than setup() */
-       if ((flags & GS_PLUGIN_REFRESH_FLAGS_METADATA) == 0)
-               return TRUE;
-
        /* check cache age */
        if (cache_age > 0) {
                guint tmp;
@@ -141,6 +136,25 @@ gs_plugin_refresh (GsPlugin *plugin,
                                        error);
 }
 
+/**
+ * gs_plugin_refresh:
+ */
+gboolean
+gs_plugin_refresh (GsPlugin *plugin,
+                  guint cache_age,
+                  GsPluginRefreshFlags flags,
+                  GCancellable *cancellable,
+                  GError **error)
+{
+       /* only for update metadata, no stored state other than setup() */
+       if ((flags & GS_PLUGIN_REFRESH_FLAGS_METADATA) == 0)
+               return TRUE;
+       return gs_plugin_fedora_distro_upgrades_refresh (plugin,
+                                                        cache_age,
+                                                        cancellable,
+                                                        error);
+}
+
 typedef enum {
        DISTRO_STATUS_ACTIVE,
        DISTRO_STATUS_DEVEL,
@@ -312,3 +326,19 @@ gs_plugin_add_distro_upgrades (GsPlugin *plugin,
 
        return TRUE;
 }
+
+/**
+ * gs_plugin_add_distro_upgrades:
+ */
+gboolean
+gs_plugin_add_distro_upgrades (GsPlugin *plugin,
+                              GList **list,
+                              GCancellable *cancellable,
+                              GError **error)
+{
+       /* just ensure there is any data, no matter how old */
+       return gs_plugin_fedora_distro_upgrades_refresh (plugin,
+                                                        G_MAXUINT,
+                                                        cancellable,
+                                                        error);
+}


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