diff --git a/libnm-core/nm-setting-private.h b/libnm-core/nm-setting-private.h index 1db3db998..2af74ec4c 100644 --- a/libnm-core/nm-setting-private.h +++ b/libnm-core/nm-setting-private.h @@ -101,9 +101,6 @@ gboolean _nm_setting_verify_secret_string (const char *str, gboolean _nm_setting_aggregate (NMSetting *setting, NMConnectionAggregateType type, gpointer arg); -gboolean _nm_setting_vpn_aggregate (NMSettingVpn *setting, - NMConnectionAggregateType type, - gpointer arg); gboolean _nm_setting_slave_type_is_valid (const char *slave_type, const char **out_port_type); diff --git a/libnm-core/nm-setting-vpn.c b/libnm-core/nm-setting-vpn.c index 1371140ec..133620b7d 100644 --- a/libnm-core/nm-setting-vpn.c +++ b/libnm-core/nm-setting-vpn.c @@ -449,20 +449,17 @@ nm_setting_vpn_foreach_secret (NMSettingVpn *setting, foreach_item_helper (setting, TRUE, func, user_data); } -gboolean -_nm_setting_vpn_aggregate (NMSettingVpn *setting, - NMConnectionAggregateType type, - gpointer arg) +static gboolean +aggregate (NMSetting *setting, + int type_i, + gpointer arg) { - NMSettingVpnPrivate *priv; + NMSettingVpnPrivate *priv = NM_SETTING_VPN_GET_PRIVATE (setting); + NMConnectionAggregateType type = type_i; NMSettingSecretFlags secret_flags; const char *key_name; GHashTableIter iter; - g_return_val_if_fail (NM_IS_SETTING_VPN (setting), FALSE); - - priv = NM_SETTING_VPN_GET_PRIVATE (setting); - switch (type) { case NM_CONNECTION_AGGREGATE_ANY_SECRETS: @@ -984,6 +981,7 @@ nm_setting_vpn_class_init (NMSettingVpnClass *klass) setting_class->need_secrets = need_secrets; setting_class->compare_property = compare_property; setting_class->clear_secrets = clear_secrets; + setting_class->aggregate = aggregate; /** * NMSettingVpn:service-type: diff --git a/libnm-core/nm-setting.c b/libnm-core/nm-setting.c index bed3a3cf1..c679e89d3 100644 --- a/libnm-core/nm-setting.c +++ b/libnm-core/nm-setting.c @@ -1812,37 +1812,17 @@ nm_setting_enumerate_values (NMSetting *setting, } } -/** - * _nm_setting_aggregate: - * @setting: the #NMSetting to aggregate. - * @type: the #NMConnectionAggregateType aggregate type. - * @arg: the in/out arguments for aggregation. They depend on @type. - * - * This is the implementation detail of _nm_connection_aggregate(). It - * makes no sense to call this function directly outside of _nm_connection_aggregate(). - * - * Returns: %TRUE if afterwards the aggregation is complete. That means, - * the only caller _nm_connection_aggregate() will not visit other settings - * after a setting returns %TRUE (indicating that there is nothing further - * to aggregate). Note that is very different from the boolean return - * argument of _nm_connection_aggregate(), which serves a different purpose. - */ -gboolean -_nm_setting_aggregate (NMSetting *setting, - NMConnectionAggregateType type, - gpointer arg) +static gboolean +aggregate (NMSetting *setting, + int type_i, + gpointer arg) { + NMConnectionAggregateType type = type_i; const NMSettInfoSetting *sett_info; guint i; - g_return_val_if_fail (NM_IS_SETTING (setting), FALSE); - g_return_val_if_fail (arg, FALSE); - g_return_val_if_fail (NM_IN_SET (type, NM_CONNECTION_AGGREGATE_ANY_SECRETS, - NM_CONNECTION_AGGREGATE_ANY_SYSTEM_SECRET_FLAGS), - FALSE); - - if (NM_IS_SETTING_VPN (setting)) - return _nm_setting_vpn_aggregate (NM_SETTING_VPN (setting), type, arg); + nm_assert (NM_IN_SET (type, NM_CONNECTION_AGGREGATE_ANY_SECRETS, + NM_CONNECTION_AGGREGATE_ANY_SYSTEM_SECRET_FLAGS)); sett_info = _nm_setting_class_get_sett_info (NM_SETTING_GET_CLASS (setting)); for (i = 0; i < sett_info->property_infos_len; i++) { @@ -1886,6 +1866,35 @@ _nm_setting_aggregate (NMSetting *setting, return FALSE; } +/** + * _nm_setting_aggregate: + * @setting: the #NMSetting to aggregate. + * @type: the #NMConnectionAggregateType aggregate type. + * @arg: the in/out arguments for aggregation. They depend on @type. + * + * This is the implementation detail of _nm_connection_aggregate(). It + * makes no sense to call this function directly outside of _nm_connection_aggregate(). + * + * Returns: %TRUE if afterwards the aggregation is complete. That means, + * the only caller _nm_connection_aggregate() will not visit other settings + * after a setting returns %TRUE (indicating that there is nothing further + * to aggregate). Note that is very different from the boolean return + * argument of _nm_connection_aggregate(), which serves a different purpose. + */ +gboolean +_nm_setting_aggregate (NMSetting *setting, + NMConnectionAggregateType type, + gpointer arg) +{ + g_return_val_if_fail (NM_IS_SETTING (setting), FALSE); + g_return_val_if_fail (arg, FALSE); + g_return_val_if_fail (NM_IN_SET (type, NM_CONNECTION_AGGREGATE_ANY_SECRETS, + NM_CONNECTION_AGGREGATE_ANY_SYSTEM_SECRET_FLAGS), + FALSE); + + return NM_SETTING_GET_CLASS (setting)->aggregate (setting, type, arg); +} + static gboolean clear_secrets (const NMSettInfoSetting *sett_info, guint property_idx, @@ -2622,6 +2631,7 @@ nm_setting_class_init (NMSettingClass *setting_class) setting_class->clear_secrets = clear_secrets; setting_class->duplicate_copy_properties = duplicate_copy_properties; setting_class->enumerate_values = enumerate_values; + setting_class->aggregate = aggregate; /** * NMSetting:name: diff --git a/libnm-core/nm-setting.h b/libnm-core/nm-setting.h index 0002b80ae..96868731e 100644 --- a/libnm-core/nm-setting.h +++ b/libnm-core/nm-setting.h @@ -247,11 +247,16 @@ typedef struct { NMSettingValueIterFn func, gpointer user_data); + /*< private >*/ + gboolean (*aggregate) (NMSetting *setting, + int type_i, + gpointer arg); + /*< private >*/ const struct _NMMetaSettingInfo *setting_info; /*< private >*/ - gpointer padding[4]; + gpointer padding[3]; } NMSettingClass; GType nm_setting_get_type (void);