[gnome-software/wip/kalev/download-step: 9/13] Use background tasks for update monitor initiated packagekit downloads
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/kalev/download-step: 9/13] Use background tasks for update monitor initiated packagekit downloads
- Date: Wed, 24 Oct 2018 06:35:35 +0000 (UTC)
commit e47c7ac3ea4c6c6732ab5c4e3e11afefad32fe41
Author: Kalev Lember <klember redhat com>
Date: Tue Oct 23 14:20:42 2018 +0200
Use background tasks for update monitor initiated packagekit downloads
Instead of forcing pk_client_set_background() to 0 for all downloads,
make it so that those initiated from the update monitor use background
tasks (1), and those that are user-initiated from the updates page use
non-background tasks (0).
We don't actually have a way to pass cache_age or the interactivity
setting down to gs_plugin_download() vfunc, so instead make sure that we
pass non-0 cache age to refresh() in the update monitor, and 0 cache age
to refresh() in the updates page, and use that setting also for deciding
if the subsequent download operation should be background or not.
With this fix the update monitor initiated background update download
should get correctly cancelled when the user clicks on something else.
plugins/packagekit/gs-plugin-packagekit-refresh.c | 3 ---
src/gs-updates-page.c | 4 +---
2 files changed, 1 insertion(+), 6 deletions(-)
---
diff --git a/plugins/packagekit/gs-plugin-packagekit-refresh.c
b/plugins/packagekit/gs-plugin-packagekit-refresh.c
index e62b20df..1383ba0b 100644
--- a/plugins/packagekit/gs-plugin-packagekit-refresh.c
+++ b/plugins/packagekit/gs-plugin-packagekit-refresh.c
@@ -68,9 +68,6 @@ _download_only (GsPlugin *plugin, GsAppList *list,
g_autoptr(PkResults) results2 = NULL;
g_autoptr(PkResults) results = NULL;
- /* cache age of 0 is user-initiated */
- pk_client_set_background (PK_CLIENT (priv->task), 0);
-
/* refresh the metadata */
gs_plugin_status_update (plugin, NULL, GS_PLUGIN_STATUS_WAITING);
results = pk_client_get_updates (PK_CLIENT (priv->task),
diff --git a/src/gs-updates-page.c b/src/gs-updates-page.c
index 9ce8ef7d..629639ee 100644
--- a/src/gs-updates-page.c
+++ b/src/gs-updates-page.c
@@ -42,8 +42,6 @@
#include <langinfo.h>
-#define GS_REFRESH_MIN_AGE 10 /* sec */
-
typedef enum {
GS_UPDATES_PAGE_FLAG_NONE = 0,
GS_UPDATES_PAGE_FLAG_HAS_UPDATES = 1 << 0,
@@ -810,7 +808,7 @@ gs_updates_page_get_new_updates (GsUpdatesPage *self)
plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_REFRESH,
"interactive", TRUE,
- "age", (guint64) GS_REFRESH_MIN_AGE,
+ "age", (guint64) 0,
NULL);
gs_plugin_loader_job_process_async (self->plugin_loader, plugin_job,
self->cancellable_refresh,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]