[gnome-software] Don't install queued apps when the network changes and is metered



commit c9de6b649fec0643a305ed1f713e64ca0e0eff38
Author: Joaquim Rocha <jrocha endlessm com>
Date:   Thu Feb 15 23:36:06 2018 +0100

    Don't install queued apps when the network changes and is metered
    
    Apps queued for installation were being installed after the network
    becomes available and even if the network was metered. This means that
    such operation can cost users money without informing them about it, so
    this patch adds the extra check before proceeding with the installation.

 lib/gs-plugin-loader.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index 9db275f4..23a27205 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -2837,14 +2837,15 @@ gs_plugin_loader_network_changed_cb (GNetworkMonitor *monitor,
                                     GsPluginLoader *plugin_loader)
 {
        GsPluginLoaderPrivate *priv = gs_plugin_loader_get_instance_private (plugin_loader);
+       gboolean metered = g_network_monitor_get_network_metered (priv->network_monitor);
 
        g_debug ("network status change: %s [%s]",
                 available ? "online" : "offline",
-                g_network_monitor_get_network_metered (priv->network_monitor) ? "metered" : "unmetered");
+                metered ? "metered" : "unmetered");
 
        g_object_notify (G_OBJECT (plugin_loader), "network-available");
 
-       if (available) {
+       if (available && !metered) {
                g_autoptr(GsAppList) queue = NULL;
                g_mutex_lock (&priv->pending_apps_mutex);
                queue = gs_app_list_new ();


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