summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2014-10-16 18:00:54 -0400
committerDan Winship <danw@gnome.org>2014-10-19 09:27:47 -0400
commit4779d96685b3e2c295218088db8a3999450da39b (patch)
tree58539c313b892c755bf24e7432c69f55475dc38d
parentd78ea27d36a0ba3039c6c1b1b94e4ae784afa4ab (diff)
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.)
-rw-r--r--src/nm-active-connection.c11
1 files changed, 10 insertions, 1 deletions
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);