[gnome-software] Do not always download updates when clicking the refresh button in the updates panel



commit ee7352c43cbb17bd375cdc1b82b58fe2056fc7f5
Author: Richard Hughes <richard hughsie com>
Date:   Fri Oct 21 11:04:36 2016 +0100

    Do not always download updates when clicking the refresh button in the updates panel
    
    Check the 'download-updates' setting before downloading the payload.

 src/gs-shell-updates.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/gs-shell-updates.c b/src/gs-shell-updates.c
index ca1a00b..cf66891 100644
--- a/src/gs-shell-updates.c
+++ b/src/gs-shell-updates.c
@@ -742,6 +742,8 @@ gs_shell_updates_refresh_cb (GsPluginLoader *plugin_loader,
 static void
 gs_shell_updates_get_new_updates (GsShellUpdates *self)
 {
+       GsPluginRefreshFlags refresh_flags = GS_PLUGIN_REFRESH_FLAGS_NONE;
+
        /* force a check for updates and download */
        gs_shell_updates_set_state (self, GS_SHELL_UPDATES_STATE_ACTION_REFRESH);
 
@@ -751,11 +753,13 @@ gs_shell_updates_get_new_updates (GsShellUpdates *self)
        }
        self->cancellable_refresh = g_cancellable_new ();
 
+       refresh_flags |= GS_PLUGIN_REFRESH_FLAGS_INTERACTIVE;
+       refresh_flags |= GS_PLUGIN_REFRESH_FLAGS_METADATA;
+       if (g_settings_get_boolean (self->settings, "download-updates"))
+               refresh_flags |= GS_PLUGIN_REFRESH_FLAGS_PAYLOAD;
        gs_plugin_loader_refresh_async (self->plugin_loader,
                                        10 * 60,
-                                       GS_PLUGIN_REFRESH_FLAGS_INTERACTIVE |
-                                       GS_PLUGIN_REFRESH_FLAGS_METADATA |
-                                       GS_PLUGIN_REFRESH_FLAGS_PAYLOAD,
+                                       refresh_flags,
                                        self->cancellable_refresh,
                                        (GAsyncReadyCallback) gs_shell_updates_refresh_cb,
                                        self);


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