[gnome-software] Use a gsetting for auto-refreshing on metered connections
- From: Joaquim Manuel Pereira Rocha <jrocha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Use a gsetting for auto-refreshing on metered connections
- Date: Fri, 14 Oct 2016 15:06:12 +0000 (UTC)
commit 0225ba0ea73cb680adb9527cef4ace47d9fa233b
Author: Joaquim Rocha <jrocha endlessm com>
Date: Fri Oct 14 11:06:31 2016 +0200
Use a gsetting for auto-refreshing on metered connections
GNOME Software was simply preventing any checks for updates when on a
metered connection but some users may have that kind of connection
as their only one and wish to perform those checks.
https://bugzilla.gnome.org/show_bug.cgi?id=772940
data/org.gnome.software.gschema.xml | 5 +++++
src/gs-update-monitor.c | 11 +++++++++--
2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/data/org.gnome.software.gschema.xml b/data/org.gnome.software.gschema.xml
index b291f45..2f9f0f5 100644
--- a/data/org.gnome.software.gschema.xml
+++ b/data/org.gnome.software.gschema.xml
@@ -10,6 +10,11 @@
<summary>Whether to automatically download updates</summary>
<description>If enabled, GNOME Software automatically downloads updates in the background and prompts
the user to install them when ready.</description>
</key>
+ <key name="refresh-when-metered" type="b">
+ <default>false</default>
+ <summary>Whether to automatically refresh when on a metered connection</summary>
+ <description>If enabled, GNOME Software automatically refreshes in the background even when using a
metered connection (eventually downloading some metadata, checking for updates, etc., which may incur in
costs for the user).</description>
+ </key>
<key name="first-run" type="b">
<default>true</default>
<summary>Whether it's the very first run of GNOME Software</summary>
diff --git a/src/gs-update-monitor.c b/src/gs-update-monitor.c
index ee3d867..5d11b72 100644
--- a/src/gs-update-monitor.c
+++ b/src/gs-update-monitor.c
@@ -337,6 +337,7 @@ static void
check_updates (GsUpdateMonitor *monitor)
{
gint64 tmp;
+ gboolean refresh_on_metered;
g_autoptr(GDateTime) last_refreshed = NULL;
g_autoptr(GDateTime) now_refreshed = NULL;
@@ -344,8 +345,14 @@ check_updates (GsUpdateMonitor *monitor)
if (monitor->network_monitor == NULL)
return;
- /* never refresh when offline or on mobile connections */
- if (!g_network_monitor_get_network_available (monitor->network_monitor) ||
+ /* never check for updates when offline */
+ if (!g_network_monitor_get_network_available (monitor->network_monitor))
+ return;
+
+ refresh_on_metered = g_settings_get_boolean (monitor->settings,
+ "refresh-when-metered");
+
+ if (!refresh_on_metered &&
g_network_monitor_get_network_metered (monitor->network_monitor))
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]