[gnome-software/jrocha/fix-install-queue: 5/8] Don't install queued when the network changes and is metered



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

    Don't install queued 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 592b7d2b..d98a982f 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -2960,14 +2960,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]