summary refs log tree commit diff
path: root/src/nm-active-connection.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nm-active-connection.c')
-rw-r--r--src/nm-active-connection.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c
index 2286a74b..65f57565 100644
--- a/src/nm-active-connection.c
+++ b/src/nm-active-connection.c
@@ -292,6 +292,36 @@ nm_active_connection_set_state (NMActiveConnection *self,
 	}
 }
 
+void
+nm_active_connection_set_state_fail (NMActiveConnection *self,
+                                     NMActiveConnectionStateReason reason,
+                                     const char *error_desc)
+{
+	NMActiveConnectionState s;
+
+	g_return_if_fail (NM_IS_ACTIVE_CONNECTION (self));
+
+	if (error_desc) {
+		_LOGD ("Failed to activate '%s': %s",
+		       nm_active_connection_get_settings_connection_id (self),
+		       error_desc);
+	}
+
+	s = nm_active_connection_get_state (self);
+	if (   s >= NM_ACTIVE_CONNECTION_STATE_ACTIVATING
+	    && s < NM_ACTIVE_CONNECTION_STATE_DEACTIVATING) {
+		nm_active_connection_set_state (self,
+		                                NM_ACTIVE_CONNECTION_STATE_DEACTIVATING,
+		                                reason);
+		s = nm_active_connection_get_state (self);
+	}
+	if (s < NM_ACTIVE_CONNECTION_STATE_DEACTIVATED) {
+		nm_active_connection_set_state (self,
+		                                NM_ACTIVE_CONNECTION_STATE_DEACTIVATED,
+		                                reason);
+	}
+}
+
 NMActivationStateFlags
 nm_active_connection_get_state_flags (NMActiveConnection *self)
 {
@@ -1236,6 +1266,7 @@ set_property (GObject *object, guint prop_id,
 		nm_active_connection_set_device (self, g_value_get_object (value));
 		break;
 	case PROP_INT_SUBJECT:
+		/* construct-only */
 		priv->subject = g_value_dup_object (value);
 		break;
 	case PROP_INT_MASTER:
@@ -1251,6 +1282,7 @@ set_property (GObject *object, guint prop_id,
 		_set_activation_type (self, (NMActivationType) i);
 		break;
 	case PROP_SPECIFIC_OBJECT:
+		/* construct-only */
 		tmp = g_value_get_string (value);
 		/* NM uses "/" to mean NULL */
 		if (g_strcmp0 (tmp, "/") != 0)
@@ -1263,6 +1295,7 @@ set_property (GObject *object, guint prop_id,
 		priv->is_default6 = g_value_get_boolean (value);
 		break;
 	case PROP_VPN:
+		/* construct-only */
 		priv->vpn = g_value_get_boolean (value);
 		break;
 	case PROP_MASTER: