mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 23:13:40 +02:00
portal network monitor: Always emit changed signal on changed
The ::network-changed signal is documented to indicate any change in network configuration, which doesn't necessarily imply a property change - additional services becoming available after connecting to a VPN comes to mind for instance. In order to match the "native" network monitor's behavior, always emit the signal when it's in response to the 'changed' D-Bus signal. Also emit the signal unconditionally when loading the initial property values, to allow clients to differentiate between "offline" meaning "offline" and "offline" meaning "uninitialized".
This commit is contained in:
committed by
Philip Withnall
parent
f042610c02
commit
a8babc792f
@@ -260,7 +260,6 @@ got_status (GObject *source,
|
||||
GNetworkMonitorPortal *nm = G_NETWORK_MONITOR_PORTAL (data);
|
||||
GError *error = NULL;
|
||||
GVariant *ret;
|
||||
gboolean should_emit_changed = FALSE;
|
||||
GVariant *status;
|
||||
gboolean available;
|
||||
gboolean metered;
|
||||
@@ -297,14 +296,12 @@ got_status (GObject *source,
|
||||
{
|
||||
nm->priv->available = available;
|
||||
g_object_notify (G_OBJECT (nm), "network-available");
|
||||
should_emit_changed = TRUE;
|
||||
}
|
||||
|
||||
if (nm->priv->metered != metered)
|
||||
{
|
||||
nm->priv->metered = metered;
|
||||
g_object_notify (G_OBJECT (nm), "network-metered");
|
||||
should_emit_changed = TRUE;
|
||||
}
|
||||
|
||||
if (nm->priv->connectivity != connectivity &&
|
||||
@@ -312,13 +309,11 @@ got_status (GObject *source,
|
||||
{
|
||||
nm->priv->connectivity = connectivity;
|
||||
g_object_notify (G_OBJECT (nm), "connectivity");
|
||||
should_emit_changed = TRUE;
|
||||
}
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (nm));
|
||||
|
||||
if (should_emit_changed)
|
||||
g_signal_emit_by_name (nm, "network-changed", available);
|
||||
g_signal_emit_by_name (nm, "network-changed", available);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user