diff options
author | Bastien Nocera <hadess@hadess.net> | 2018-10-29 11:20:59 +0000 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2018-10-29 11:20:59 +0000 |
commit | d11883b6efdd8604aee28b8973ac16d2c6ba1208 (patch) | |
tree | af98b93d08fa589dfd197e76fa50664a23b4d676 /src | |
parent | 04e69a81fa34b62c9415f4e6b8df30cfee5a0ad5 (diff) | |
download | geoclue-wip/hadess/reduce-internet-avail.tar.gz |
web-source: Update internet availability when connectivity changeswip/hadess/reduce-internet-avail
Going from limited ("captive portal") to full internet should update the
internet availability.
Diffstat (limited to 'src')
-rw-r--r-- | src/gclue-web-source.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gclue-web-source.c b/src/gclue-web-source.c index f361e29..4e45041 100644 --- a/src/gclue-web-source.c +++ b/src/gclue-web-source.c @@ -45,6 +45,7 @@ struct _GClueWebSourcePrivate { SoupMessage *query; gulong network_changed_id; + gulong connectivity_changed_id; guint64 last_submitted; @@ -185,6 +186,14 @@ on_network_changed (GNetworkMonitor *monitor G_GNUC_UNUSED, } static void +on_connectivity_changed (GObject *gobject, + GParamSpec *pspec, + gpointer user_data) +{ + on_network_changed (NULL, NULL, user_data); +} + +static void gclue_web_source_finalize (GObject *gsource) { GClueWebSourcePrivate *priv = GCLUE_WEB_SOURCE (gsource)->priv; @@ -195,6 +204,12 @@ gclue_web_source_finalize (GObject *gsource) priv->network_changed_id = 0; } + if (priv->connectivity_changed_id) { + g_signal_handler_disconnect (g_network_monitor_get_default (), + priv->connectivity_changed_id); + priv->connectivity_changed_id = 0; + } + if (priv->query != NULL) { g_debug ("Cancelling query"); soup_session_cancel_message (priv->soup_session, @@ -227,6 +242,11 @@ gclue_web_source_constructed (GObject *object) "network-changed", G_CALLBACK (on_network_changed), object); + priv->connectivity_changed_id = + g_signal_connect (monitor, + "notify::connectivity", + G_CALLBACK (on_connectivity_changed), + object); on_network_changed (NULL, TRUE, object); |