policy: add nm_settings_connection_autoconnect_is_blocked() helper function

(cherry picked from commit 36ac08c092)
This commit is contained in:
Thomas Haller 2017-11-24 13:20:55 +01:00
parent d4530effb8
commit 01dbbf1404
3 changed files with 12 additions and 2 deletions

View file

@ -1222,8 +1222,7 @@ auto_activate_device (NMPolicy *self,
const char *permission;
if ( !nm_settings_connection_is_visible (candidate)
|| nm_settings_connection_autoconnect_retries_get (candidate) == 0
|| nm_settings_connection_autoconnect_blocked_reason_get (candidate, NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_ALL))
|| nm_settings_connection_autoconnect_is_blocked (candidate))
continue;
s_con = nm_connection_get_setting_connection (NM_CONNECTION (candidate));

View file

@ -2646,6 +2646,15 @@ nm_settings_connection_autoconnect_blocked_reason_set_full (NMSettingsConnection
return TRUE;
}
gboolean
nm_settings_connection_autoconnect_is_blocked (NMSettingsConnection *self)
{
NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
return !priv->autoconnect_blocked_reason
&& priv->autoconnect_retries != 0;
}
/*****************************************************************************/
/**

View file

@ -239,6 +239,8 @@ nm_settings_connection_autoconnect_blocked_reason_set (NMSettingsConnection *sel
return nm_settings_connection_autoconnect_blocked_reason_set_full (self, mask, set ? mask : NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_NONE);
}
gboolean nm_settings_connection_autoconnect_is_blocked (NMSettingsConnection *self);
gboolean nm_settings_connection_get_nm_generated (NMSettingsConnection *self);
gboolean nm_settings_connection_get_volatile (NMSettingsConnection *self);