[gnome-software/182-gs-shell-skip-refresh-on-start-when-download-updates-is-set-to-false] gs-shell: Skip refresh on start when download-updates is set to false



commit 43031d9ef3b2f2a714b23045f3921abcc618996c
Author: Milan Crha <mcrha redhat com>
Date:   Tue Nov 24 17:46:52 2020 +0100

    gs-shell: Skip refresh on start when download-updates is set to false
    
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/182
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/merge_requests/548

 src/gs-shell.c          |  9 +++++++--
 src/gs-update-monitor.c | 15 +++++++++++++++
 2 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 7c8cb2d4..e677ab70 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -2293,8 +2293,13 @@ gs_shell_setup (GsShell *shell, GsPluginLoader *plugin_loader, GCancellable *can
        /* primary menu */
        gs_shell_add_about_menu_item (shell);
 
-       /* show loading page, which triggers the initial refresh */
-       gs_shell_change_mode (shell, GS_SHELL_MODE_LOADING, NULL, TRUE);
+       if (g_settings_get_boolean (priv->settings, "download-updates")) {
+               /* show loading page, which triggers the initial refresh */
+               gs_shell_change_mode (shell, GS_SHELL_MODE_LOADING, NULL, TRUE);
+       } else {
+               g_debug ("Skipped refresh of the repositories due to 'download-updates' disabled");
+               initial_refresh_done (GS_LOADING_PAGE (page), shell);
+       }
 }
 
 void
diff --git a/src/gs-update-monitor.c b/src/gs-update-monitor.c
index 296a5127..63114bbd 100644
--- a/src/gs-update-monitor.c
+++ b/src/gs-update-monitor.c
@@ -179,6 +179,16 @@ no_updates_for_a_week (GsUpdateMonitor *monitor)
        return FALSE;
 }
 
+static gboolean
+should_download_updates (GsUpdateMonitor *monitor)
+{
+#ifdef HAVE_MOGWAI
+       return TRUE;
+#else
+       return g_settings_get_boolean (monitor->settings, "download-updates");
+#endif
+}
+
 static gboolean
 _filter_by_app_kind (GsApp *app, gpointer user_data)
 {
@@ -838,6 +848,11 @@ check_updates (GsUpdateMonitor *monitor)
                        return;
        }
 
+       if (!should_download_updates (monitor)) {
+               get_updates (monitor);
+               return;
+       }
+
        g_debug ("Daily update check due");
        plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_REFRESH,
                                         "age", (guint64) (60 * 60 * 24),


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