[polari/wip/fmuellner/metered-connections] application: Defer loading of room lists on metered connections



commit 26842e3d4fc1be8ae413eb9885d31dba6cdc5a8c
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Nov 28 17:06:39 2017 +0100

    application: Defer loading of room lists on metered connections
    
    We currently load all room lists immediately on startup, to hopefully
    have them readily available when the user opens the join dialog. In
    case the user doesn't use the dialog, this means we download the lists
    unnecessarily, trading efficiency for convenience. This is a reasonable
    trade-off where bandwidth usage isn't a concern (that is, network access
    is sufficiently fast and cheap), but may very well be the wrong choice
    otherwise.
    
    At least in case where NetworkManager tells us that a connection is
    metered, deferring loading the room lists until the join dialog is used
    is the better option.

 src/application.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/src/application.js b/src/application.js
index 66aa6c0..254a130 100644
--- a/src/application.js
+++ b/src/application.js
@@ -250,7 +250,9 @@ var Application = GObject.registerClass({
         this._accountsMonitor = AccountsMonitor.getDefault();
         this._userStatusMonitor = UserStatusMonitor.getDefault();
         this._networksManager = NetworksManager.getDefault();
-        this._serverRoomManager = ServerRoomManager.getDefault();
+
+        if (!Gio.NetworkMonitor.get_default().get_network_metered())
+            this._serverRoomManager = ServerRoomManager.getDefault();
 
         this._accountsMonitor.connect('account-status-changed',
                                       this._onAccountStatusChanged.bind(this));


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