[glib/glib-2-58: 4/6] portal network monitor: Always emit changed signal on changed



commit a8babc792f6cbda250c0359a36aa017b5a38e483
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Aug 31 20:04:41 2018 +0200

    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".

 gio/gnetworkmonitorportal.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
---
diff --git a/gio/gnetworkmonitorportal.c b/gio/gnetworkmonitorportal.c
index 3c4c2f696..9a5820ab6 100644
--- a/gio/gnetworkmonitorportal.c
+++ b/gio/gnetworkmonitorportal.c
@@ -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


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