From 88c227d90a6b7b388c5c85d72802a0ca8f05ed5c Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Thu, 13 Jan 2022 22:30:39 +0100 Subject: New upstream version 1.34.0 --- src/libnm-core-impl/nm-setting-bluetooth.c | 97 ++++++++---------------------- 1 file changed, 24 insertions(+), 73 deletions(-) (limited to 'src/libnm-core-impl/nm-setting-bluetooth.c') diff --git a/src/libnm-core-impl/nm-setting-bluetooth.c b/src/libnm-core-impl/nm-setting-bluetooth.c index 4bd91a69..53e4912f 100644 --- a/src/libnm-core-impl/nm-setting-bluetooth.c +++ b/src/libnm-core-impl/nm-setting-bluetooth.c @@ -94,6 +94,8 @@ nm_setting_bluetooth_get_bdaddr(NMSettingBluetooth *setting) return NM_SETTING_BLUETOOTH_GET_PRIVATE(setting)->bdaddr; } +/*****************************************************************************/ + static gboolean verify(NMSetting *setting, NMConnection *connection, GError **error) { @@ -228,46 +230,6 @@ verify(NMSetting *setting, NMConnection *connection, GError **error) /*****************************************************************************/ -static void -get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) -{ - NMSettingBluetooth *setting = NM_SETTING_BLUETOOTH(object); - - switch (prop_id) { - case PROP_BDADDR: - g_value_set_string(value, nm_setting_bluetooth_get_bdaddr(setting)); - break; - case PROP_TYPE: - g_value_set_string(value, nm_setting_bluetooth_get_connection_type(setting)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); - break; - } -} - -static void -set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) -{ - NMSettingBluetoothPrivate *priv = NM_SETTING_BLUETOOTH_GET_PRIVATE(object); - - switch (prop_id) { - case PROP_BDADDR: - g_free(priv->bdaddr); - priv->bdaddr = g_value_dup_string(value); - break; - case PROP_TYPE: - g_free(priv->type); - priv->type = g_value_dup_string(value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); - break; - } -} - -/*****************************************************************************/ - static void nm_setting_bluetooth_init(NMSettingBluetooth *setting) {} @@ -285,17 +247,6 @@ nm_setting_bluetooth_new(void) return g_object_new(NM_TYPE_SETTING_BLUETOOTH, NULL); } -static void -finalize(GObject *object) -{ - NMSettingBluetoothPrivate *priv = NM_SETTING_BLUETOOTH_GET_PRIVATE(object); - - g_free(priv->bdaddr); - g_free(priv->type); - - G_OBJECT_CLASS(nm_setting_bluetooth_parent_class)->finalize(object); -} - static void nm_setting_bluetooth_class_init(NMSettingBluetoothClass *klass) { @@ -305,9 +256,8 @@ nm_setting_bluetooth_class_init(NMSettingBluetoothClass *klass) g_type_class_add_private(klass, sizeof(NMSettingBluetoothPrivate)); - object_class->get_property = get_property; - object_class->set_property = set_property; - object_class->finalize = finalize; + object_class->get_property = _nm_setting_property_get_property_direct; + object_class->set_property = _nm_setting_property_set_property_direct; setting_class->verify = verify; @@ -316,15 +266,14 @@ nm_setting_bluetooth_class_init(NMSettingBluetoothClass *klass) * * The Bluetooth address of the device. **/ - obj_properties[PROP_BDADDR] = g_param_spec_string( - NM_SETTING_BLUETOOTH_BDADDR, - "", - "", - NULL, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS); - _nm_properties_override_gobj(properties_override, - obj_properties[PROP_BDADDR], - &nm_sett_info_propert_type_mac_address); + _nm_setting_property_define_direct_mac_address(properties_override, + obj_properties, + NM_SETTING_BLUETOOTH_BDADDR, + PROP_BDADDR, + NM_SETTING_PARAM_INFERRABLE, + NMSettingBluetoothPrivate, + bdaddr, + .direct_set_string_mac_address_len = ETH_ALEN); /** * NMSettingBluetooth:type: @@ -332,17 +281,19 @@ nm_setting_bluetooth_class_init(NMSettingBluetoothClass *klass) * Either "dun" for Dial-Up Networking connections or "panu" for Personal * Area Networking connections to devices supporting the NAP profile. **/ - obj_properties[PROP_TYPE] = g_param_spec_string(NM_SETTING_BLUETOOTH_TYPE, - "", - "", - NULL, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE - | G_PARAM_STATIC_STRINGS); + _nm_setting_property_define_direct_string(properties_override, + obj_properties, + NM_SETTING_BLUETOOTH_TYPE, + PROP_TYPE, + NM_SETTING_PARAM_INFERRABLE, + NMSettingBluetoothPrivate, + type); g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties); - _nm_setting_class_commit_full(setting_class, - NM_META_SETTING_TYPE_BLUETOOTH, - NULL, - properties_override); + _nm_setting_class_commit(setting_class, + NM_META_SETTING_TYPE_BLUETOOTH, + NULL, + properties_override, + NM_SETT_INFO_PRIVATE_OFFSET_FROM_CLASS); } -- cgit 1.3.0-6-gf8a5