[gnome-software] Change how the payload flag is used in the updates monitor



commit 1d3f85f5650c3d3672674d8ab8e6853721281985
Author: Joaquim Rocha <jrocha endlessm com>
Date:   Fri Oct 14 11:25:32 2016 +0200

    Change how the payload flag is used in the updates monitor
    
    This patch makes the updates monitor use the payload flag only if
    the download-updates setting is true. Otherwise it just uses the
    metadata flag.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=772940

 src/gs-update-monitor.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/src/gs-update-monitor.c b/src/gs-update-monitor.c
index 5d11b72..e47cb1e 100644
--- a/src/gs-update-monitor.c
+++ b/src/gs-update-monitor.c
@@ -340,6 +340,7 @@ check_updates (GsUpdateMonitor *monitor)
        gboolean refresh_on_metered;
        g_autoptr(GDateTime) last_refreshed = NULL;
        g_autoptr(GDateTime) now_refreshed = NULL;
+       GsPluginRefreshFlags refresh_flags = GS_PLUGIN_REFRESH_FLAGS_METADATA;
 
        /* we don't know the network state */
        if (monitor->network_monitor == NULL)
@@ -402,14 +403,16 @@ check_updates (GsUpdateMonitor *monitor)
        g_settings_set (monitor->settings, "check-timestamp", "x",
                        g_date_time_to_unix (now_refreshed));
 
-       /* NOTE: this doesn't actually refresh the cache, it actually just checks
-        * for updates (which might happen to also refresh the cache as a side
-        * effect) and then downloads new packages */
-       g_debug ("Refreshing cache");
+       if (g_settings_get_boolean (monitor->settings, "download-updates")) {
+               g_debug ("Refreshing for metadata and payload");
+               refresh_flags |= GS_PLUGIN_REFRESH_FLAGS_PAYLOAD;
+       } else {
+               g_debug ("Refreshing for metadata only");
+       }
+
        gs_plugin_loader_refresh_async (monitor->plugin_loader,
                                        60 * 60 * 24,
-                                       GS_PLUGIN_REFRESH_FLAGS_METADATA |
-                                       GS_PLUGIN_REFRESH_FLAGS_PAYLOAD,
+                                       refresh_flags,
                                        monitor->cancellable,
                                        refresh_cache_finished_cb,
                                        monitor);


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