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



commit 2c32bda5e5cb41aeebcc9e1de85c8608fa514ed0
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.
    
    Fixes https://gitlab.gnome.org/GNOME/polari/issues/29

 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]