[gnome-maps/gnome-3-26] application: Use GNetworkMonitor::connectivity instead of can_reach_async()



commit cf4ea497c5ce3ebac7bb56d83969440dc3bf6314
Author: Marcus Lundblad <ml update uu se>
Date:   Wed Oct 4 21:50:36 2017 +0200

    application: Use GNetworkMonitor::connectivity instead of can_reach_async()
    
    can_reach_async() doesn't seem to work well from a Flatpak.
    Relying on the connectivity property should be enough, and also should
    handle the captive portal case (if the user's system has enable
    captive portal detection in NetworkManager).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=777706

 src/application.js |   13 +------------
 1 files changed, 1 insertions(+), 12 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 3bcef84..5164823 100644
--- a/src/application.js
+++ b/src/application.js
@@ -114,18 +114,7 @@ var Application = new Lang.Class({
     },
 
     _checkNetwork: function() {
-        let addr = new Gio.NetworkAddress({ hostname: 'tile.openstreetmap.org',
-                                            port: 80 });
-
-        networkMonitor.can_reach_async(addr, null, (function(networkMonitor, res) {
-            try {
-                if (networkMonitor.can_reach_finish(res))
-                    this.connected = true;
-            } catch(e) {
-                this.connected = false;
-                Utils.debug('Connection failed: ' + e.message);
-            }
-        }).bind(this));
+        this.connected = networkMonitor.connectivity === Gio.NetworkConnectivity.FULL;
     },
 
     _showContact: function(id) {


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