diff options
author | Thomas Haller <thaller@redhat.com> | 2019-03-22 11:06:21 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-03-25 09:12:33 +0100 |
commit | a1c7b04664e1792de38e1136d089e69e85374565 (patch) | |
tree | 42d6116033d475e355d995a90c7fb590b77feb92 | |
parent | 3a8fe7ad457cf9dbf672e3ca0d719c3e33b524ba (diff) | |
download | NetworkManager-a1c7b04664e1792de38e1136d089e69e85374565.tar.gz |
nmcli: add clear_all_fcn() hook for mutllist property types
-rw-r--r-- | clients/common/nm-meta-setting-desc.c | 17 | ||||
-rw-r--r-- | clients/common/nm-meta-setting-desc.h | 1 |
2 files changed, 14 insertions, 4 deletions
diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c index c2e19f5021..27db431549 100644 --- a/clients/common/nm-meta-setting-desc.c +++ b/clients/common/nm-meta-setting-desc.c @@ -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)) { diff --git a/clients/common/nm-meta-setting-desc.h b/clients/common/nm-meta-setting-desc.h index 9a7438c672..cc94c2547d 100644 --- a/clients/common/nm-meta-setting-desc.h +++ b/clients/common/nm-meta-setting-desc.h @@ -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, |