libnm-core: make GBytes D-Bus marshalling be built-in to NMSetting
Each GBytes-valued property was using _nm_setting_class_transform_property() to register a GBytes<->'ay' transform. So just build that rule into the generic machinery in nm-setting.c.
This commit is contained in:
@@ -3206,10 +3206,6 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class)
|
||||
G_TYPE_BYTES,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
_nm_setting_class_transform_property (parent_class, NM_SETTING_802_1X_CA_CERT,
|
||||
G_VARIANT_TYPE_BYTESTRING,
|
||||
_nm_utils_bytes_to_dbus,
|
||||
_nm_utils_bytes_from_dbus);
|
||||
|
||||
/**
|
||||
* NMSetting8021x:ca-path:
|
||||
@@ -3302,10 +3298,6 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class)
|
||||
G_TYPE_BYTES,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
_nm_setting_class_transform_property (parent_class, NM_SETTING_802_1X_CLIENT_CERT,
|
||||
G_VARIANT_TYPE_BYTESTRING,
|
||||
_nm_utils_bytes_to_dbus,
|
||||
_nm_utils_bytes_from_dbus);
|
||||
|
||||
/**
|
||||
* NMSetting8021x:phase1-peapver:
|
||||
@@ -3456,10 +3448,6 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class)
|
||||
G_TYPE_BYTES,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
_nm_setting_class_transform_property (parent_class, NM_SETTING_802_1X_PHASE2_CA_CERT,
|
||||
G_VARIANT_TYPE_BYTESTRING,
|
||||
_nm_utils_bytes_to_dbus,
|
||||
_nm_utils_bytes_from_dbus);
|
||||
|
||||
/**
|
||||
* NMSetting8021x:phase2-ca-path:
|
||||
@@ -3549,10 +3537,6 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class)
|
||||
G_TYPE_BYTES,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
_nm_setting_class_transform_property (parent_class, NM_SETTING_802_1X_PHASE2_CLIENT_CERT,
|
||||
G_VARIANT_TYPE_BYTESTRING,
|
||||
_nm_utils_bytes_to_dbus,
|
||||
_nm_utils_bytes_from_dbus);
|
||||
|
||||
/**
|
||||
* NMSetting8021x:password:
|
||||
@@ -3616,10 +3600,6 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class)
|
||||
G_PARAM_READWRITE |
|
||||
NM_SETTING_PARAM_SECRET |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
_nm_setting_class_transform_property (parent_class, NM_SETTING_802_1X_PASSWORD_RAW,
|
||||
G_VARIANT_TYPE_BYTESTRING,
|
||||
_nm_utils_bytes_to_dbus,
|
||||
_nm_utils_bytes_from_dbus);
|
||||
|
||||
/**
|
||||
* NMSetting8021x:password-raw-flags:
|
||||
@@ -3684,10 +3664,6 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class)
|
||||
G_TYPE_BYTES,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
_nm_setting_class_transform_property (parent_class, NM_SETTING_802_1X_PRIVATE_KEY,
|
||||
G_VARIANT_TYPE_BYTESTRING,
|
||||
_nm_utils_bytes_to_dbus,
|
||||
_nm_utils_bytes_from_dbus);
|
||||
|
||||
/**
|
||||
* NMSetting8021x:private-key-password:
|
||||
@@ -3772,10 +3748,6 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class)
|
||||
G_TYPE_BYTES,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
_nm_setting_class_transform_property (parent_class, NM_SETTING_802_1X_PHASE2_PRIVATE_KEY,
|
||||
G_VARIANT_TYPE_BYTESTRING,
|
||||
_nm_utils_bytes_to_dbus,
|
||||
_nm_utils_bytes_from_dbus);
|
||||
|
||||
/**
|
||||
* NMSetting8021x:phase2-private-key-password:
|
||||
|
@@ -233,10 +233,6 @@ nm_setting_olpc_mesh_class_init (NMSettingOlpcMeshClass *setting_class)
|
||||
G_PARAM_READWRITE |
|
||||
NM_SETTING_PARAM_INFERRABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
_nm_setting_class_transform_property (parent_class, NM_SETTING_OLPC_MESH_SSID,
|
||||
G_VARIANT_TYPE_BYTESTRING,
|
||||
_nm_utils_bytes_to_dbus,
|
||||
_nm_utils_bytes_from_dbus);
|
||||
|
||||
/**
|
||||
* NMSettingOlpcMesh:channel:
|
||||
|
@@ -1014,10 +1014,6 @@ nm_setting_wireless_class_init (NMSettingWirelessClass *setting_class)
|
||||
G_TYPE_BYTES,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
_nm_setting_class_transform_property (parent_class, NM_SETTING_WIRELESS_SSID,
|
||||
G_VARIANT_TYPE_BYTESTRING,
|
||||
_nm_utils_bytes_to_dbus,
|
||||
_nm_utils_bytes_from_dbus);
|
||||
|
||||
/**
|
||||
* NMSettingWireless:mode:
|
||||
|
@@ -645,6 +645,8 @@ get_property_for_dbus (NMSetting *setting,
|
||||
dbus_value = g_variant_new_int32 (g_value_get_enum (&prop_value));
|
||||
else if (g_type_is_a (prop_value.g_type, G_TYPE_FLAGS))
|
||||
dbus_value = g_variant_new_uint32 (g_value_get_flags (&prop_value));
|
||||
else if (prop_value.g_type == G_TYPE_BYTES)
|
||||
dbus_value = _nm_utils_bytes_to_dbus (&prop_value);
|
||||
else
|
||||
dbus_value = g_dbus_gvalue_to_gvariant (&prop_value, variant_type_for_gtype (prop_value.g_type));
|
||||
g_value_unset (&prop_value);
|
||||
@@ -659,6 +661,8 @@ set_property_from_dbus (const NMSettingProperty *property, GVariant *src_value,
|
||||
|
||||
if (property->from_dbus)
|
||||
property->from_dbus (src_value, dst_value);
|
||||
else if (dst_value->g_type == G_TYPE_BYTES)
|
||||
_nm_utils_bytes_from_dbus (src_value, dst_value);
|
||||
else
|
||||
g_dbus_gvariant_to_gvalue (src_value, dst_value);
|
||||
}
|
||||
|
Reference in New Issue
Block a user