core: allow ActiveConnection connection to be changed

For the case of AddAndActivate, which needs to set the final connection
after authentication is done and NMSettings has returned the final
connection.
This commit is contained in:
Dan Williams 2013-08-28 11:43:50 -05:00
parent 8252357dd1
commit ae116d847e
2 changed files with 18 additions and 0 deletions

View file

@ -133,6 +133,21 @@ nm_active_connection_get_connection (NMActiveConnection *self)
return NM_ACTIVE_CONNECTION_GET_PRIVATE (self)->connection;
}
void
nm_active_connection_set_connection (NMActiveConnection *self,
NMConnection *connection)
{
NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (self);
/* Can't change connection after the ActiveConnection is exported over D-Bus */
g_return_if_fail (priv->path == NULL);
g_return_if_fail (priv->connection == NULL || !NM_IS_SETTINGS_CONNECTION (priv->connection));
if (priv->connection)
g_object_unref (priv->connection);
priv->connection = g_object_ref (connection);
}
const char *
nm_active_connection_get_path (NMActiveConnection *self)
{

View file

@ -77,6 +77,9 @@ void nm_active_connection_export (NMActiveConnection *self);
NMConnection *nm_active_connection_get_connection (NMActiveConnection *self);
void nm_active_connection_set_connection (NMActiveConnection *self,
NMConnection *connection);
const char * nm_active_connection_get_name (NMActiveConnection *self);
const char * nm_active_connection_get_path (NMActiveConnection *self);