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-16 18:00:54 -0400
commitc335d319e8e52600e065e4147fa651c1002c3605 (patch)
treea718fdc84c3bc02061335b30b2ecba193ff378f4
parent690776e8f4531d8e3012bd07b209a5b557a86c75 (diff)
downloadNetworkManager-danw/bgo737993-objectcache.tar.gz
core: lie about NMActiveConnection:state in new connectionsdanw/bgo737993-objectcache
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);