From 4779d96685b3e2c295218088db8a3999450da39b Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Thu, 16 Oct 2014 18:00:54 -0400 Subject: [PATCH] core: lie about NMActiveConnection:state in new connections NMActiveConnections start out in state "unknown", but then quickly switch to "activating". Unfortunately, it's sometimes possible for this to be externally visible. Fix this by lying and saying that state is "activating" during the initial "unknown" stage (though not if the state changes to "unknown" later on). (Actually changing the initial state to "activating" breaks things because some code depends on there being a transition into the "activating" state.) --- src/nm-active-connection.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c index 3e532e5225..d91f462663 100644 --- a/src/nm-active-connection.c +++ b/src/nm-active-connection.c @@ -51,6 +51,7 @@ typedef struct { gboolean is_default; gboolean is_default6; NMActiveConnectionState state; + gboolean state_set; gboolean vpn; NMAuthSubject *subject; @@ -138,6 +139,7 @@ nm_active_connection_set_state (NMActiveConnection *self, old_state = priv->state; priv->state = new_state; + priv->state_set = TRUE; g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_STATE); check_master_ready (self); @@ -748,7 +750,14 @@ get_property (GObject *object, guint prop_id, g_value_take_boxed (value, devices); break; case PROP_STATE: - g_value_set_uint (value, priv->state); + if (priv->state_set) + g_value_set_uint (value, priv->state); + else { + /* When the AC has just been created, its externally-visible state should + * be "ACTIVATING", even though internally it is "UNKNOWN". + */ + g_value_set_uint (value, NM_ACTIVE_CONNECTION_STATE_ACTIVATING); + } break; case PROP_DEFAULT: g_value_set_boolean (value, priv->is_default);