libnm: always set from_dbus_fcn() property hook
When looking at a property, it should always be clear how it is handled. Also the "default" action should be an explicit hook. Add _nm_setting_property_from_dbus_fcn_gprop() and set that as from_dbus_fcn() callback to handle the "default" case which us build around g_object_set_property(). While this adds lines of code, I think it makes the code easier to understand. Basically, to convert a GVariant to a property, now all properties call their from_dbus_fcn() handler, there is no special casing. And the gprop-hook is only called for properties that are using _nm_setting_property_from_dbus_fcn_gprop(). So, you can reason about these two functions at separate layers.
This commit is contained in:
@@ -577,10 +577,12 @@ nm_setting_user_class_init(NMSettingUserClass *klass)
|
||||
properties_override,
|
||||
obj_properties[PROP_DATA],
|
||||
NM_SETT_INFO_PROPERT_TYPE_GPROP(NM_G_VARIANT_TYPE("a{ss}"),
|
||||
.gprop_from_dbus_fcn = _nm_utils_strdict_from_dbus,
|
||||
.typdata_from_dbus.gprop_fcn = _nm_utils_strdict_from_dbus,
|
||||
.typdata_to_dbus.gprop_type =
|
||||
NM_SETTING_PROPERTY_TO_DBUS_FCN_GPROP_TYPE_STRDICT,
|
||||
.compare_fcn = compare_fcn_data));
|
||||
.compare_fcn = compare_fcn_data,
|
||||
.from_dbus_fcn = _nm_setting_property_from_dbus_fcn_gprop,
|
||||
.from_dbus_is_full = TRUE));
|
||||
|
||||
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
|
Reference in New Issue
Block a user