[gnome-software] fwupd: Add support for download scheduling
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] fwupd: Add support for download scheduling
- Date: Wed, 17 Jul 2019 07:46:03 +0000 (UTC)
commit 5b31ba51046d454c6fc485cac388253ece6ef6aa
Author: Philip Withnall <withnall endlessm com>
Date: Thu Mar 21 17:30:51 2019 +0000
fwupd: Add support for download scheduling
Signed-off-by: Philip Withnall <withnall endlessm com>
plugins/fwupd/gs-plugin-fwupd.c | 12 ++++++++++++
plugins/fwupd/meson.build | 14 ++++++++++----
2 files changed, 22 insertions(+), 4 deletions(-)
---
diff --git a/plugins/fwupd/gs-plugin-fwupd.c b/plugins/fwupd/gs-plugin-fwupd.c
index cf6abfa9..8d4961e9 100644
--- a/plugins/fwupd/gs-plugin-fwupd.c
+++ b/plugins/fwupd/gs-plugin-fwupd.c
@@ -18,6 +18,7 @@
#include <gnome-software.h>
#include "gs-fwupd-app.h"
+#include "gs-metered.h"
/*
* SECTION:
@@ -905,6 +906,17 @@ gs_plugin_download_app (GsPlugin *plugin,
filename = g_file_get_path (local_file);
if (!g_file_query_exists (local_file, cancellable)) {
const gchar *uri = gs_fwupd_app_get_update_uri (app);
+
+ if (!gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE)) {
+ g_autoptr(GError) error_local = NULL;
+
+ if (!gs_metered_block_app_on_download_scheduler (app, cancellable, &error_local)) {
+ g_warning ("Failed to block on download scheduler: %s",
+ error_local->message);
+ g_clear_error (&error_local);
+ }
+ }
+
if (!gs_plugin_download_file (plugin, app, uri, filename,
cancellable, error))
return FALSE;
diff --git a/plugins/fwupd/meson.build b/plugins/fwupd/meson.build
index bf3c7e86..965a5e27 100644
--- a/plugins/fwupd/meson.build
+++ b/plugins/fwupd/meson.build
@@ -1,5 +1,13 @@
cargs = ['-DG_LOG_DOMAIN="GsPluginFwupd"']
cargs += ['-DLOCALPLUGINDIR="' + meson.current_build_dir() + '"']
+deps = [
+ plugin_libs,
+ fwupd,
+]
+
+if get_option('mogwai')
+ deps += [mogwai_schedule_client]
+endif
shared_module(
'gs_plugin_fwupd',
@@ -14,7 +22,7 @@ shared_module(
install : true,
install_dir: plugin_dir,
c_args : cargs,
- dependencies : [ plugin_libs, fwupd ],
+ dependencies : deps,
link_with : [
libgnomesoftware
]
@@ -42,9 +50,7 @@ if get_option('tests')
include_directories('../..'),
include_directories('../../lib'),
],
- dependencies : [
- plugin_libs,
- ],
+ dependencies : deps,
link_with : [
libgnomesoftware
],
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]