nmcli: add clear_all_fcn() hook for mutllist property types

This commit is contained in:
Thomas Haller 2019-03-22 11:06:21 +01:00
parent 3a8fe7ad45
commit a1c7b04664
2 changed files with 14 additions and 4 deletions

View file

@ -1836,8 +1836,13 @@ _set_fcn_multilist (ARGS_SET_FCN)
gs_free const char **strv = NULL;
gsize i, j, nstrv;
if (_SET_FCN_DO_RESET_DEFAULT_WITH_SUPPORTS_REMOVE (property_info, modifier, value))
return _gobject_property_reset_default (setting, property_info->property_name);
if (_SET_FCN_DO_RESET_DEFAULT_WITH_SUPPORTS_REMOVE (property_info, modifier, value)) {
if (property_info->property_typ_data->subtype.multilist.clear_all_fcn) {
property_info->property_typ_data->subtype.multilist.clear_all_fcn (setting);
return TRUE;
}
return _gobject_property_reset (setting, property_info->property_name, FALSE);
}
if ( _SET_FCN_DO_REMOVE (modifier, value)
&& ( property_info->property_typ_data->subtype.multilist.remove_by_idx_fcn_u32
@ -1890,8 +1895,12 @@ _set_fcn_multilist (ARGS_SET_FCN)
}
nstrv = j;
if (_SET_FCN_DO_SET_ALL (modifier, value))
_gobject_property_reset (setting, property_info->property_name, FALSE);
if (_SET_FCN_DO_SET_ALL (modifier, value)) {
if (property_info->property_typ_data->subtype.multilist.clear_all_fcn)
property_info->property_typ_data->subtype.multilist.clear_all_fcn (setting);
else
_gobject_property_reset (setting, property_info->property_name, FALSE);
}
for (i = 0; i < nstrv; i++) {
if (_SET_FCN_DO_REMOVE (modifier, value)) {

View file

@ -269,6 +269,7 @@ struct _NMMetaPropertyTypData {
struct {
guint32 (*get_num_fcn_u32) (NMSetting *setting);
guint (*get_num_fcn_u) (NMSetting *setting);
void (*clear_all_fcn) (NMSetting *setting);
gboolean (*add_fcn) (NMSetting *setting,
const char *item);
void (*add2_fcn) (NMSetting *setting,