libnm: add _nm_connection_get_setting_bluetooth_for_nap()

If there is value in such a helper function (there is), then
it should go alongside the other nm_connection_get_setting*()
helpers. NMDevice is already large enough.
This commit is contained in:
Thomas Haller 2017-05-31 22:37:49 +02:00 committed by Lubomir Rintel
parent 1be01bd51f
commit b0f9571d3d
3 changed files with 18 additions and 16 deletions

View file

@ -2518,6 +2518,17 @@ nm_connection_get_setting_vlan (NMConnection *connection)
return (NMSettingVlan *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VLAN);
}
NMSettingBluetooth *
_nm_connection_get_setting_bluetooth_for_nap (NMConnection *connection)
{
NMSettingBluetooth *s_bt = nm_connection_get_setting_bluetooth (connection);
if ( s_bt
&& nm_streq0 (nm_setting_bluetooth_get_connection_type (s_bt), NM_SETTING_BLUETOOTH_TYPE_NAP))
return s_bt;
return NULL;
}
/*****************************************************************************/
static void

View file

@ -352,6 +352,10 @@ gboolean _nm_setting_bond_option_supported (const char *option, NMBondMode mode)
/*****************************************************************************/
NMSettingBluetooth *_nm_connection_get_setting_bluetooth_for_nap (NMConnection *connection);
/*****************************************************************************/
gboolean _nm_utils_inet6_is_token (const struct in6_addr *in6addr);
/*****************************************************************************/

View file

@ -4366,23 +4366,10 @@ dnsmasq_state_changed_cb (NMDnsMasqManager *manager, guint32 status, gpointer us
const NMBtVTableNetworkServer *nm_bt_vtable_network_server = NULL;
static NMSettingBluetooth *
_setting_bluetooth_for_bt_nap (NMConnection *connection)
{
NMSettingBluetooth *s_bt = nm_connection_get_setting_bluetooth (connection);
if (!s_bt)
return NULL;
if (!nm_streq0 (nm_setting_bluetooth_get_connection_type (s_bt), NM_SETTING_BLUETOOTH_TYPE_NAP))
return NULL;
return s_bt;
}
static gboolean
bt_network_server_available (NMConnection *connection)
{
NMSettingBluetooth *s_bt = _setting_bluetooth_for_bt_nap (connection);
NMSettingBluetooth *s_bt = _nm_connection_get_setting_bluetooth_for_nap (connection);
if (!s_bt)
return TRUE;
@ -4396,7 +4383,7 @@ static gboolean
bt_network_server_register (NMDevice *self)
{
NMConnection *connection = nm_device_get_applied_connection (self);
NMSettingBluetooth *s_bt = _setting_bluetooth_for_bt_nap (connection);
NMSettingBluetooth *s_bt = _nm_connection_get_setting_bluetooth_for_nap (connection);
if (!s_bt)
return TRUE;
@ -4415,7 +4402,7 @@ bt_network_server_unregister (NMDevice *self)
if (!connection)
return;
s_bt = _setting_bluetooth_for_bt_nap (connection);
s_bt = _nm_connection_get_setting_bluetooth_for_nap (connection);
if (!s_bt)
return;