mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-06-20 07:08:29 +02:00
libnm: refactor to_dbus_fcn() for "wifi-sec.wep-key-type" property
The goal is to get rid of gprop_to_dbus_fcn() uses.
This commit is contained in:
parent
a0cf869daa
commit
c07f617bff
1 changed files with 22 additions and 9 deletions
|
|
@ -1290,13 +1290,24 @@ set_secret_flags(NMSetting * setting,
|
|||
->set_secret_flags(setting, secret_name, flags, error);
|
||||
}
|
||||
|
||||
/* NMSettingWirelessSecurity:wep-key-type is an enum, but needs to be marshalled
|
||||
* as 'u', not 'i', for backward-compatibility.
|
||||
*/
|
||||
static GVariant *
|
||||
wep_key_type_to_dbus(const GValue *from)
|
||||
wep_key_type_to_dbus(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options)
|
||||
{
|
||||
return g_variant_new_uint32(g_value_get_enum(from));
|
||||
NMWepKeyType t;
|
||||
|
||||
t = nm_setting_wireless_security_get_wep_key_type(NM_SETTING_WIRELESS_SECURITY(setting));
|
||||
if (t == NM_WEP_KEY_TYPE_UNKNOWN)
|
||||
return NULL;
|
||||
|
||||
/* NMSettingWirelessSecurity:wep-key-type is an enum, but needs to be marshalled
|
||||
* as 'u', not 'i', for backward-compatibility.
|
||||
*/
|
||||
return g_variant_new_uint32(t);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
@ -1924,10 +1935,12 @@ nm_setting_wireless_security_class_init(NMSettingWirelessSecurityClass *klass)
|
|||
NM_TYPE_WEP_KEY_TYPE,
|
||||
NM_WEP_KEY_TYPE_UNKNOWN,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
_nm_properties_override_gobj(properties_override,
|
||||
obj_properties[PROP_WEP_KEY_TYPE],
|
||||
&nm_sett_info_propert_type_plain_u,
|
||||
.to_dbus_data.gprop_to_dbus_fcn = wep_key_type_to_dbus, );
|
||||
_nm_properties_override_gobj(
|
||||
properties_override,
|
||||
obj_properties[PROP_WEP_KEY_TYPE],
|
||||
NM_SETT_INFO_PROPERT_TYPE_DBUS(G_VARIANT_TYPE_UINT32,
|
||||
.to_dbus_fcn = wep_key_type_to_dbus,
|
||||
.compare_fcn = _nm_setting_property_compare_fcn_default));
|
||||
|
||||
/**
|
||||
* NMSettingWirelessSecurity:wps-method:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue