diff options
author | Thomas Haller <thaller@redhat.com> | 2017-12-05 12:10:16 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-12-05 19:57:25 +0100 |
commit | 545e3111c89c4dc13a69d5cdfdd381d2be3cc971 (patch) | |
tree | 41a42bf82a24f916cfd1a1e77e8aa7d8b9c2621d | |
parent | 4549bd07a1c62d9d063cf7fd3ae3b6854890fc9a (diff) | |
download | NetworkManager-545e3111c89c4dc13a69d5cdfdd381d2be3cc971.tar.gz |
settings: remove accessor functions to connection flags
The accessor functions just look whether a certain flag is set. As these
functions have a different name then the flags, this is more confusing
then helpful. For example, if you want to know where the NM_GENERATED
flag matters, you had to know to grep for nm_settings_connection_get_nm_generated()
in addition to NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED.
The accessor function hid that the property was implemented as
a connection flag. For example, it was not immediately obvious
that nm_settings_connection_get_nm_generated() is the same
as having the NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED flag
set.
Drop them.
-rw-r--r-- | src/devices/bluetooth/nm-bluez-device.c | 3 | ||||
-rw-r--r-- | src/devices/nm-device.c | 6 | ||||
-rw-r--r-- | src/nm-active-connection.c | 3 | ||||
-rw-r--r-- | src/nm-manager.c | 6 | ||||
-rw-r--r-- | src/nm-policy.c | 6 | ||||
-rw-r--r-- | src/settings/nm-settings-connection.c | 42 | ||||
-rw-r--r-- | src/settings/nm-settings-connection.h | 5 |
7 files changed, 18 insertions, 53 deletions
diff --git a/src/devices/bluetooth/nm-bluez-device.c b/src/devices/bluetooth/nm-bluez-device.c index 182527d9f5..bd3cf18a67 100644 --- a/src/devices/bluetooth/nm-bluez-device.c +++ b/src/devices/bluetooth/nm-bluez-device.c @@ -1185,7 +1185,8 @@ dispose (GObject *object) if (priv->pan_connection) { /* Check whether we want to remove the created connection. If so, we take a reference * and delete it at the end of dispose(). */ - if (nm_settings_connection_get_nm_generated (NM_SETTINGS_CONNECTION (priv->pan_connection))) + if (NM_FLAGS_HAS (nm_settings_connection_get_flags (NM_SETTINGS_CONNECTION (priv->pan_connection)), + NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED)) to_delete = g_object_ref (priv->pan_connection); priv->pan_connection = NULL; diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 2e034cc47a..f79b85e8c2 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -10174,7 +10174,8 @@ nm_device_set_ip4_config (NMDevice *self, if ( nm_device_sys_iface_state_is_external (self) && (settings_connection = nm_device_get_settings_connection (self)) - && nm_settings_connection_get_nm_generated (settings_connection) + && NM_FLAGS_HAS (nm_settings_connection_get_flags (settings_connection), + NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED) && nm_active_connection_get_activation_type (NM_ACTIVE_CONNECTION (priv->act_request)) == NM_ACTIVATION_TYPE_EXTERNAL) { NMSetting *s_ip4; @@ -10345,7 +10346,8 @@ nm_device_set_ip6_config (NMDevice *self, if ( nm_device_sys_iface_state_is_external (self) && (settings_connection = nm_device_get_settings_connection (self)) - && nm_settings_connection_get_nm_generated (settings_connection) + && NM_FLAGS_HAS (nm_settings_connection_get_flags (settings_connection), + NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED) && nm_active_connection_get_activation_type (NM_ACTIVE_CONNECTION (priv->act_request)) == NM_ACTIVATION_TYPE_EXTERNAL) { NMSetting *s_ip6; diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c index c27f6548eb..2286a74b4f 100644 --- a/src/nm-active-connection.c +++ b/src/nm-active-connection.c @@ -866,7 +866,8 @@ _settings_connection_notify_flags (NMSettingsConnection *settings_connection, nm_assert (nm_active_connection_get_activation_type (self) == NM_ACTIVATION_TYPE_EXTERNAL); nm_assert (NM_ACTIVE_CONNECTION_GET_PRIVATE (self)->settings_connection == settings_connection); - if (nm_settings_connection_get_nm_generated (settings_connection)) + if (NM_FLAGS_HAS (nm_settings_connection_get_flags (settings_connection), + NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED)) return; _set_activation_type_managed (self); diff --git a/src/nm-manager.c b/src/nm-manager.c index 178fbfa71b..b665047a09 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -329,7 +329,8 @@ active_connection_remove (NMManager *self, NMActiveConnection *active) g_signal_handlers_disconnect_by_func (active, active_connection_parent_active, self); if ( (connection = nm_active_connection_get_settings_connection (active)) - && nm_settings_connection_get_volatile (connection)) + && NM_FLAGS_HAS (nm_settings_connection_get_flags (connection), + NM_SETTINGS_CONNECTION_FLAGS_VOLATILE)) g_object_ref (connection); else connection = NULL; @@ -498,7 +499,8 @@ _get_activatable_connections_filter (NMSettings *settings, NMSettingsConnection *connection, gpointer user_data) { - if (nm_settings_connection_get_volatile (connection)) + if (NM_FLAGS_HAS (nm_settings_connection_get_flags (connection), + NM_SETTINGS_CONNECTION_FLAGS_VOLATILE)) return FALSE; return !active_connection_find_first (user_data, connection, NULL, NM_ACTIVE_CONNECTION_STATE_DEACTIVATING); } diff --git a/src/nm-policy.c b/src/nm-policy.c index ded84cc2e4..e0fe7efaa6 100644 --- a/src/nm-policy.c +++ b/src/nm-policy.c @@ -1224,7 +1224,8 @@ auto_activate_device (NMPolicy *self, NMSettingConnection *s_con; const char *permission; - if ( !nm_settings_connection_is_visible (candidate) + if ( !NM_FLAGS_HAS (nm_settings_connection_get_flags (candidate), + NM_SETTINGS_CONNECTION_FLAGS_VISIBLE) || nm_settings_connection_autoconnect_is_blocked (candidate)) continue; @@ -2382,7 +2383,8 @@ connection_flags_changed (NMSettings *settings, NMPolicyPrivate *priv = user_data; NMPolicy *self = _PRIV_TO_SELF (priv); - if (nm_settings_connection_is_visible (connection)) + if (NM_FLAGS_HAS (nm_settings_connection_get_flags (connection), + NM_SETTINGS_CONNECTION_FLAGS_VISIBLE)) schedule_activate_all (self); else _deactivate_if_active (self, connection); diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c index 45caffb9f5..80f7b290fb 100644 --- a/src/settings/nm-settings-connection.c +++ b/src/settings/nm-settings-connection.c @@ -324,14 +324,6 @@ set_visible (NMSettingsConnection *self, gboolean new_visible) new_visible); } -gboolean -nm_settings_connection_is_visible (NMSettingsConnection *self) -{ - g_return_val_if_fail (NM_IS_SETTINGS_CONNECTION (self), FALSE); - - return NM_FLAGS_HAS (NM_SETTINGS_CONNECTION_GET_PRIVATE (self)->flags, NM_SETTINGS_CONNECTION_FLAGS_VISIBLE); -} - void nm_settings_connection_recheck_visibility (NMSettingsConnection *self) { @@ -397,7 +389,8 @@ nm_settings_connection_check_permission (NMSettingsConnection *self, priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self); - if (!nm_settings_connection_is_visible (self)) + if (!NM_FLAGS_HAS (nm_settings_connection_get_flags (self), + NM_SETTINGS_CONNECTION_FLAGS_VISIBLE)) return FALSE; s_con = nm_connection_get_setting_connection (NM_CONNECTION (self)); @@ -2750,37 +2743,6 @@ nm_settings_connection_autoconnect_is_blocked (NMSettingsConnection *self) /*****************************************************************************/ -/** - * nm_settings_connection_get_nm_generated: - * @self: an #NMSettingsConnection - * - * Gets the "nm-generated" flag on @self. - * - * A connection is "nm-generated" if it was generated by - * nm_device_generate_connection() and has not been modified or - * saved by the user since then. - */ -gboolean -nm_settings_connection_get_nm_generated (NMSettingsConnection *self) -{ - return NM_FLAGS_HAS (nm_settings_connection_get_flags (self), NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED); -} - -/** - * nm_settings_connection_get_volatile: - * @self: an #NMSettingsConnection - * - * Gets the "volatile" flag on @self. - * - * The connection is marked as volatile and will be removed when - * it disconnects. - */ -gboolean -nm_settings_connection_get_volatile (NMSettingsConnection *self) -{ - return NM_FLAGS_HAS (nm_settings_connection_get_flags (self), NM_SETTINGS_CONNECTION_FLAGS_VOLATILE); -} - gboolean nm_settings_connection_get_ready (NMSettingsConnection *self) { diff --git a/src/settings/nm-settings-connection.h b/src/settings/nm-settings-connection.h index 0c10e1ca8c..7615fb4655 100644 --- a/src/settings/nm-settings-connection.h +++ b/src/settings/nm-settings-connection.h @@ -176,8 +176,6 @@ NMSettingsConnectionCallId *nm_settings_connection_get_secrets (NMSettingsConnec void nm_settings_connection_cancel_secrets (NMSettingsConnection *self, NMSettingsConnectionCallId *call_id); -gboolean nm_settings_connection_is_visible (NMSettingsConnection *self); - void nm_settings_connection_recheck_visibility (NMSettingsConnection *self); gboolean nm_settings_connection_check_permission (NMSettingsConnection *self, @@ -238,9 +236,6 @@ nm_settings_connection_autoconnect_blocked_reason_set (NMSettingsConnection *sel 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); - gboolean nm_settings_connection_get_ready (NMSettingsConnection *self); void nm_settings_connection_set_ready (NMSettingsConnection *self, gboolean ready); |