active-connection: use activation-type for active connection instead of assumed flag

This commit is contained in:
Thomas Haller
2017-03-08 08:26:48 +01:00
parent 8a31e66d2c
commit 3973f8ebcd
3 changed files with 3 additions and 22 deletions

View File

@@ -49,7 +49,6 @@ typedef struct _NMActiveConnectionPrivate {
bool is_default6:1; bool is_default6:1;
bool state_set:1; bool state_set:1;
bool vpn:1; bool vpn:1;
bool assumed:1;
bool master_ready:1; bool master_ready:1;
NMActivationType activation_type:3; NMActivationType activation_type:3;
@@ -568,7 +567,7 @@ nm_active_connection_set_device (NMActiveConnection *self, NMDevice *device)
g_signal_connect (device, "notify::" NM_DEVICE_METERED, g_signal_connect (device, "notify::" NM_DEVICE_METERED,
G_CALLBACK (device_metered_changed), self); G_CALLBACK (device_metered_changed), self);
if (!priv->assumed) { if (priv->activation_type == NM_ACTIVATION_TYPE_MANAGED) {
priv->pending_activation_id = g_strdup_printf (NM_PENDING_ACTIONPREFIX_ACTIVATION"%p", (void *)self); priv->pending_activation_id = g_strdup_printf (NM_PENDING_ACTIONPREFIX_ACTIVATION"%p", (void *)self);
nm_device_add_pending_action (device, priv->pending_activation_id, TRUE); nm_device_add_pending_action (device, priv->pending_activation_id, TRUE);
} }
@@ -722,24 +721,10 @@ nm_active_connection_get_activation_type (NMActiveConnection *self)
return NM_ACTIVE_CONNECTION_GET_PRIVATE (self)->activation_type; return NM_ACTIVE_CONNECTION_GET_PRIVATE (self)->activation_type;
} }
void
nm_active_connection_set_assumed (NMActiveConnection *self, gboolean assumed)
{
NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (self);
g_return_if_fail (priv->assumed == FALSE);
priv->assumed = assumed;
if (priv->pending_activation_id) {
nm_device_remove_pending_action (priv->device, priv->pending_activation_id, TRUE);
g_clear_pointer (&priv->pending_activation_id, g_free);
}
}
gboolean gboolean
nm_active_connection_get_assumed (NMActiveConnection *self) nm_active_connection_get_assumed (NMActiveConnection *self)
{ {
return NM_ACTIVE_CONNECTION_GET_PRIVATE (self)->assumed; return nm_active_connection_get_activation_type (self) == NM_ACTIVATION_TYPE_ASSUME;
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@@ -159,9 +159,6 @@ void nm_active_connection_set_master (NMActiveConnection *self,
void nm_active_connection_set_parent (NMActiveConnection *self, void nm_active_connection_set_parent (NMActiveConnection *self,
NMActiveConnection *parent); NMActiveConnection *parent);
void nm_active_connection_set_assumed (NMActiveConnection *self,
gboolean assumed);
gboolean nm_active_connection_get_assumed (NMActiveConnection *self); gboolean nm_active_connection_get_assumed (NMActiveConnection *self);
NMActivationType nm_active_connection_get_activation_type (NMActiveConnection *self); NMActivationType nm_active_connection_get_activation_type (NMActiveConnection *self);

View File

@@ -1837,7 +1837,7 @@ assume_connection (NMManager *self, NMDevice *device, NMSettingsConnection *conn
subject = nm_auth_subject_new_internal (); subject = nm_auth_subject_new_internal ();
active = _new_active_connection (self, NM_CONNECTION (connection), NULL, NULL, active = _new_active_connection (self, NM_CONNECTION (connection), NULL, NULL,
device, subject, NM_ACTIVATION_TYPE_MANAGED, &error); device, subject, NM_ACTIVATION_TYPE_ASSUME, &error);
g_object_unref (subject); g_object_unref (subject);
if (!active) { if (!active) {
@@ -1853,7 +1853,6 @@ assume_connection (NMManager *self, NMDevice *device, NMSettingsConnection *conn
if (find_master (self, NM_CONNECTION (connection), device, NULL, NULL, &master_ac, NULL) && master_ac) if (find_master (self, NM_CONNECTION (connection), device, NULL, NULL, &master_ac, NULL) && master_ac)
nm_active_connection_set_master (active, master_ac); nm_active_connection_set_master (active, master_ac);
nm_active_connection_set_assumed (active, TRUE);
nm_exported_object_export (NM_EXPORTED_OBJECT (active)); nm_exported_object_export (NM_EXPORTED_OBJECT (active));
active_connection_add (self, active); active_connection_add (self, active);
nm_device_queue_activation (device, NM_ACT_REQUEST (active)); nm_device_queue_activation (device, NM_ACT_REQUEST (active));