Commit d567ae26 authored by Zeeshan Ali's avatar Zeeshan Ali

web-source: Tame the 'network-changed' signal

Only refresh location if network goes down before it goes up. This fixes
the spam we generate on ignorable changes to network setup.
parent c94e9cc8
......@@ -44,6 +44,8 @@ struct _GClueWebSourcePrivate {
gulong network_changed_id;
guint64 last_submitted;
gboolean network_available;
};
G_DEFINE_ABSTRACT_TYPE (GClueWebSource, gclue_web_source, GCLUE_TYPE_LOCATION_SOURCE)
......@@ -95,12 +97,16 @@ on_network_changed (GNetworkMonitor *monitor,
{
GClueWebSource *web = GCLUE_WEB_SOURCE (user_data);
GError *error = NULL;
gboolean last_available = web->priv->network_available;
web->priv->network_available = available;
if (last_available == available)
return; /* We already reacted to netork change */
if (!available) {
g_debug ("Network unreachable");
g_debug ("Network unavailable");
return;
}
g_debug ("Network changed");
g_debug ("Network available");
if (web->priv->query != NULL)
return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment