portal network monitor: Always emit ::network-changed

The documentation of this signal is not really clear,
but it seems safer to emit it for all changes, even
if available is unchanged.
This commit is contained in:
Matthias Clasen 2018-08-24 13:56:25 +00:00
parent 8f2393b9b6
commit 3a3a32a2bb

View File

@ -149,6 +149,7 @@ got_metered (GObject *source,
{ {
nm->priv->metered = metered; nm->priv->metered = metered;
g_object_notify (G_OBJECT (nm), "network-metered"); g_object_notify (G_OBJECT (nm), "network-metered");
g_signal_emit_by_name (nm, "network-changed", nm->priv->available);
} }
} }
@ -178,6 +179,7 @@ got_connectivity (GObject *source,
{ {
nm->priv->connectivity = connectivity; nm->priv->connectivity = connectivity;
g_object_notify (G_OBJECT (nm), "connectivity"); g_object_notify (G_OBJECT (nm), "connectivity");
g_signal_emit_by_name (nm, "network-changed", nm->priv->available);
} }
} }
@ -219,6 +221,8 @@ proxy_properties_changed (GDBusProxy *proxy,
GVariant *invalidated, GVariant *invalidated,
GNetworkMonitorPortal *nm) GNetworkMonitorPortal *nm)
{ {
gboolean should_emit_changed = FALSE;
if (!nm->priv->has_network) if (!nm->priv->has_network)
return; return;
@ -234,6 +238,7 @@ proxy_properties_changed (GDBusProxy *proxy,
{ {
nm->priv->connectivity = connectivity; nm->priv->connectivity = connectivity;
g_object_notify (G_OBJECT (nm), "connectivity"); g_object_notify (G_OBJECT (nm), "connectivity");
should_emit_changed = TRUE;
} }
g_variant_unref (ret); g_variant_unref (ret);
} }
@ -246,6 +251,7 @@ proxy_properties_changed (GDBusProxy *proxy,
{ {
nm->priv->metered = metered; nm->priv->metered = metered;
g_object_notify (G_OBJECT (nm), "network-metered"); g_object_notify (G_OBJECT (nm), "network-metered");
should_emit_changed = TRUE;
} }
g_variant_unref (ret); g_variant_unref (ret);
} }
@ -258,11 +264,14 @@ proxy_properties_changed (GDBusProxy *proxy,
{ {
nm->priv->available = available; nm->priv->available = available;
g_object_notify (G_OBJECT (nm), "network-available"); g_object_notify (G_OBJECT (nm), "network-available");
g_signal_emit_by_name (nm, "network-changed", available); should_emit_changed = TRUE;
} }
g_variant_unref (ret); g_variant_unref (ret);
} }
} }
if (should_emit_changed)
g_signal_emit_by_name (nm, "network-changed", nm->priv->available);
} }
static gboolean static gboolean