mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-03 20:40:34 +01:00
clients: set @out_is_default in property getters
This commit is contained in:
parent
1f2319dcb9
commit
50414353e1
2 changed files with 117 additions and 27 deletions
|
|
@ -115,10 +115,12 @@ _metagen_ip4_config_get_fcn (const NMMetaEnvironment *environment,
|
|||
char **arr;
|
||||
const char *const*arrc;
|
||||
guint i = 0;
|
||||
const char *str;
|
||||
|
||||
nm_assert (info->info_type < _NMC_GENERIC_INFO_TYPE_IP4_CONFIG_NUM);
|
||||
|
||||
NMC_HANDLE_TERMFORMAT (NM_META_TERM_COLOR_NORMAL);
|
||||
NM_SET_OUT (out_is_default, TRUE);
|
||||
|
||||
switch (info->info_type) {
|
||||
case NMC_GENERIC_INFO_TYPE_IP4_CONFIG_ADDRESS:
|
||||
|
|
@ -139,7 +141,9 @@ _metagen_ip4_config_get_fcn (const NMMetaEnvironment *environment,
|
|||
arr = NULL;
|
||||
goto arr_out;
|
||||
case NMC_GENERIC_INFO_TYPE_IP4_CONFIG_GATEWAY:
|
||||
return nm_ip_config_get_gateway (cfg4);
|
||||
str = nm_ip_config_get_gateway (cfg4);
|
||||
NM_SET_OUT (out_is_default, !str);
|
||||
return str;
|
||||
case NMC_GENERIC_INFO_TYPE_IP4_CONFIG_ROUTE:
|
||||
if (!NM_FLAGS_HAS (get_flags, NM_META_ACCESSOR_GET_FLAGS_ACCEPT_STRV))
|
||||
return NULL;
|
||||
|
|
@ -167,10 +171,12 @@ _metagen_ip4_config_get_fcn (const NMMetaEnvironment *environment,
|
|||
g_return_val_if_reached (NULL);
|
||||
|
||||
arrc_out:
|
||||
NM_SET_OUT (out_is_default, !arrc || !arrc[0]);
|
||||
*out_flags |= NM_META_ACCESSOR_GET_OUT_FLAGS_STRV;
|
||||
return arrc;
|
||||
|
||||
arr_out:
|
||||
NM_SET_OUT (out_is_default, !arr || !arr[0]);
|
||||
*out_flags |= NM_META_ACCESSOR_GET_OUT_FLAGS_STRV;
|
||||
*out_to_free = arr;
|
||||
return arr;
|
||||
|
|
@ -192,10 +198,12 @@ _metagen_ip6_config_get_fcn (const NMMetaEnvironment *environment,
|
|||
char **arr;
|
||||
const char *const*arrc;
|
||||
guint i = 0;
|
||||
const char *str;
|
||||
|
||||
nm_assert (info->info_type < _NMC_GENERIC_INFO_TYPE_IP6_CONFIG_NUM);
|
||||
|
||||
NMC_HANDLE_TERMFORMAT (NM_META_TERM_COLOR_NORMAL);
|
||||
NM_SET_OUT (out_is_default, TRUE);
|
||||
|
||||
switch (info->info_type) {
|
||||
case NMC_GENERIC_INFO_TYPE_IP6_CONFIG_ADDRESS:
|
||||
|
|
@ -216,7 +224,9 @@ _metagen_ip6_config_get_fcn (const NMMetaEnvironment *environment,
|
|||
arr = NULL;
|
||||
goto arr_out;
|
||||
case NMC_GENERIC_INFO_TYPE_IP6_CONFIG_GATEWAY:
|
||||
return nm_ip_config_get_gateway (cfg6);
|
||||
str = nm_ip_config_get_gateway (cfg6);
|
||||
NM_SET_OUT (out_is_default, !str);
|
||||
return str;
|
||||
case NMC_GENERIC_INFO_TYPE_IP6_CONFIG_ROUTE:
|
||||
if (!NM_FLAGS_HAS (get_flags, NM_META_ACCESSOR_GET_FLAGS_ACCEPT_STRV))
|
||||
return NULL;
|
||||
|
|
@ -239,10 +249,12 @@ _metagen_ip6_config_get_fcn (const NMMetaEnvironment *environment,
|
|||
g_return_val_if_reached (NULL);
|
||||
|
||||
arrc_out:
|
||||
NM_SET_OUT (out_is_default, !arrc || !arrc[0]);
|
||||
*out_flags |= NM_META_ACCESSOR_GET_OUT_FLAGS_STRV;
|
||||
return arrc;
|
||||
|
||||
arr_out:
|
||||
NM_SET_OUT (out_is_default, !arr || !arr[0]);
|
||||
*out_flags |= NM_META_ACCESSOR_GET_OUT_FLAGS_STRV;
|
||||
*out_to_free = arr;
|
||||
return arr;
|
||||
|
|
|
|||
|
|
@ -673,6 +673,33 @@ _env_warn_fcn (const NMMetaEnvironment *environment,
|
|||
return ((*(out_to_free)) = _val); \
|
||||
} G_STMT_END
|
||||
|
||||
static gboolean
|
||||
property_is_default (NMSetting *setting, const char *prop_name)
|
||||
{
|
||||
nm_auto_unset_gvalue GValue v = G_VALUE_INIT;
|
||||
GParamSpec *pspec;
|
||||
GHashTable *ht;
|
||||
char **strv;
|
||||
|
||||
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (setting)),
|
||||
prop_name);
|
||||
if (!G_IS_PARAM_SPEC (pspec))
|
||||
g_return_val_if_reached (FALSE);
|
||||
|
||||
g_value_init (&v, pspec->value_type);
|
||||
g_object_get_property (G_OBJECT (setting), prop_name, &v);
|
||||
|
||||
if (pspec->value_type == G_TYPE_STRV) {
|
||||
strv = g_value_get_boxed (&v);
|
||||
return !strv || !strv[0];
|
||||
} else if (pspec->value_type == G_TYPE_HASH_TABLE) {
|
||||
ht = g_value_get_boxed (&v);
|
||||
return !ht || !g_hash_table_size (ht);
|
||||
}
|
||||
|
||||
return g_param_value_defaults (pspec, &v);
|
||||
}
|
||||
|
||||
static gconstpointer
|
||||
_get_fcn_nmc_with_default (ARGS_GET_FCN)
|
||||
{
|
||||
|
|
@ -681,6 +708,7 @@ _get_fcn_nmc_with_default (ARGS_GET_FCN)
|
|||
GValue val = G_VALUE_INIT;
|
||||
|
||||
RETURN_UNSUPPORTED_GET_TYPE ();
|
||||
NM_SET_OUT (out_is_default, property_is_default (setting, property_info->property_name));
|
||||
|
||||
if (property_info->property_typ_data->subtype.get_with_default.fcn (setting)) {
|
||||
if (get_type == NM_META_ACCESSOR_GET_TYPE_PRETTY)
|
||||
|
|
@ -696,6 +724,7 @@ _get_fcn_nmc_with_default (ARGS_GET_FCN)
|
|||
else
|
||||
s_full = g_strdup (s && *s ? s : " ");
|
||||
g_value_unset (&val);
|
||||
|
||||
RETURN_STR_TO_FREE (s_full);
|
||||
}
|
||||
|
||||
|
|
@ -703,6 +732,7 @@ static gconstpointer
|
|||
_get_fcn_gobject_impl (const NMMetaPropertyInfo *property_info,
|
||||
NMSetting *setting,
|
||||
NMMetaAccessorGetType get_type,
|
||||
gboolean *out_is_default,
|
||||
gpointer *out_to_free)
|
||||
{
|
||||
char *s;
|
||||
|
|
@ -711,6 +741,7 @@ _get_fcn_gobject_impl (const NMMetaPropertyInfo *property_info,
|
|||
nm_auto_unset_gvalue GValue val = G_VALUE_INIT;
|
||||
|
||||
RETURN_UNSUPPORTED_GET_TYPE ();
|
||||
NM_SET_OUT (out_is_default, property_is_default (setting, property_info->property_name));
|
||||
|
||||
gtype_prop = _gobject_property_get_gtype (G_OBJECT (setting), property_info->property_name);
|
||||
|
||||
|
|
@ -736,13 +767,13 @@ _get_fcn_gobject_impl (const NMMetaPropertyInfo *property_info,
|
|||
static gconstpointer
|
||||
_get_fcn_gobject (ARGS_GET_FCN)
|
||||
{
|
||||
return _get_fcn_gobject_impl (property_info, setting, get_type, out_to_free);
|
||||
return _get_fcn_gobject_impl (property_info, setting, get_type, out_is_default, out_to_free);
|
||||
}
|
||||
|
||||
static gconstpointer
|
||||
_get_fcn_gobject_int (ARGS_GET_FCN)
|
||||
{
|
||||
const GParamSpec *pspec;
|
||||
GParamSpec *pspec;
|
||||
nm_auto_unset_gvalue GValue gval = G_VALUE_INIT;
|
||||
gint64 v;
|
||||
const NMMetaUtilsIntValueInfo *value_infos;
|
||||
|
|
@ -755,6 +786,7 @@ _get_fcn_gobject_int (ARGS_GET_FCN)
|
|||
|
||||
g_value_init (&gval, pspec->value_type);
|
||||
g_object_get_property (G_OBJECT (setting), property_info->property_name, &gval);
|
||||
NM_SET_OUT (out_is_default, g_param_value_defaults (pspec, &gval));
|
||||
switch (pspec->value_type) {
|
||||
case G_TYPE_INT:
|
||||
v = g_value_get_int (&gval);
|
||||
|
|
@ -794,10 +826,11 @@ _get_fcn_gobject_mtu (ARGS_GET_FCN)
|
|||
|
||||
if ( !property_info->property_typ_data
|
||||
|| !property_info->property_typ_data->subtype.mtu.get_fcn)
|
||||
return _get_fcn_gobject_impl (property_info, setting, get_type, out_to_free);
|
||||
return _get_fcn_gobject_impl (property_info, setting, get_type, out_is_default, out_to_free);
|
||||
|
||||
mtu = property_info->property_typ_data->subtype.mtu.get_fcn (setting);
|
||||
if (mtu == 0) {
|
||||
NM_SET_OUT (out_is_default, TRUE);
|
||||
if (get_type == NM_META_ACCESSOR_GET_TYPE_PRETTY)
|
||||
return _("auto");
|
||||
return "auto";
|
||||
|
|
@ -824,7 +857,6 @@ static gconstpointer
|
|||
_get_fcn_gobject_enum (ARGS_GET_FCN)
|
||||
{
|
||||
GType gtype = 0;
|
||||
GType gtype_prop;
|
||||
nm_auto_unref_gtypeclass GTypeClass *gtype_class = NULL;
|
||||
nm_auto_unref_gtypeclass GTypeClass *gtype_prop_class = NULL;
|
||||
const struct _NMUtilsEnumValueInfo *value_infos = NULL;
|
||||
|
|
@ -838,6 +870,7 @@ _get_fcn_gobject_enum (ARGS_GET_FCN)
|
|||
gboolean format_text_l10n = FALSE;
|
||||
gs_free char *s = NULL;
|
||||
char s_numeric[64];
|
||||
GParamSpec *pspec;
|
||||
|
||||
RETURN_UNSUPPORTED_GET_TYPE ();
|
||||
|
||||
|
|
@ -880,25 +913,26 @@ _get_fcn_gobject_enum (ARGS_GET_FCN)
|
|||
|
||||
nm_assert (format_text || format_numeric);
|
||||
|
||||
gtype_prop = _gobject_property_get_gtype (G_OBJECT (setting), property_info->property_name);
|
||||
|
||||
g_value_init (&gval, gtype_prop);
|
||||
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (setting), property_info->property_name);
|
||||
g_return_val_if_fail (pspec, NULL);
|
||||
|
||||
g_value_init (&gval, pspec->value_type);
|
||||
g_object_get_property (G_OBJECT (setting), property_info->property_name, &gval);
|
||||
NM_SET_OUT (out_is_default, g_param_value_defaults (pspec, &gval));
|
||||
|
||||
if ( gtype_prop == G_TYPE_INT
|
||||
|| ( G_TYPE_IS_CLASSED (gtype_prop)
|
||||
&& G_IS_ENUM_CLASS ((gtype_prop_class ?: (gtype_prop_class = g_type_class_ref (gtype_prop)))))) {
|
||||
if (gtype_prop == G_TYPE_INT) {
|
||||
if ( pspec->value_type == G_TYPE_INT
|
||||
|| ( G_TYPE_IS_CLASSED (pspec->value_type)
|
||||
&& G_IS_ENUM_CLASS ((gtype_prop_class ?: (gtype_prop_class = g_type_class_ref (pspec->value_type)))))) {
|
||||
if (pspec->value_type == G_TYPE_INT) {
|
||||
if (!has_gtype)
|
||||
g_return_val_if_reached (NULL);
|
||||
v = g_value_get_int (&gval);
|
||||
} else
|
||||
v = g_value_get_enum (&gval);
|
||||
} else if ( gtype_prop == G_TYPE_UINT
|
||||
|| ( G_TYPE_IS_CLASSED (gtype_prop)
|
||||
&& G_IS_FLAGS_CLASS ((gtype_prop_class ?: (gtype_prop_class = g_type_class_ref (gtype_prop)))))) {
|
||||
if (gtype_prop == G_TYPE_UINT) {
|
||||
} else if ( pspec->value_type == G_TYPE_UINT
|
||||
|| ( G_TYPE_IS_CLASSED (pspec->value_type)
|
||||
&& G_IS_FLAGS_CLASS ((gtype_prop_class ?: (gtype_prop_class = g_type_class_ref (pspec->value_type)))))) {
|
||||
if (pspec->value_type == G_TYPE_UINT) {
|
||||
if (!has_gtype)
|
||||
g_return_val_if_reached (NULL);
|
||||
v = g_value_get_uint (&gval);
|
||||
|
|
@ -908,7 +942,7 @@ _get_fcn_gobject_enum (ARGS_GET_FCN)
|
|||
g_return_val_if_reached (NULL);
|
||||
|
||||
if (!has_gtype) {
|
||||
gtype = gtype_prop;
|
||||
gtype = pspec->value_type;
|
||||
gtype_class = g_steal_pointer (>ype_prop_class);
|
||||
}
|
||||
|
||||
|
|
@ -1915,6 +1949,7 @@ _get_fcn_802_1x_ca_cert (ARGS_GET_FCN)
|
|||
break;
|
||||
}
|
||||
|
||||
NM_SET_OUT (out_is_default, !ca_cert_str || !ca_cert_str[0]);
|
||||
RETURN_STR_TO_FREE (ca_cert_str);
|
||||
}
|
||||
|
||||
|
|
@ -1943,6 +1978,7 @@ _get_fcn_802_1x_client_cert (ARGS_GET_FCN)
|
|||
break;
|
||||
}
|
||||
|
||||
NM_SET_OUT (out_is_default, !cert_str || !cert_str[0]);
|
||||
RETURN_STR_TO_FREE (cert_str);
|
||||
}
|
||||
|
||||
|
|
@ -1968,6 +2004,7 @@ _get_fcn_802_1x_phase2_ca_cert (ARGS_GET_FCN)
|
|||
break;
|
||||
}
|
||||
|
||||
NM_SET_OUT (out_is_default, !phase2_ca_cert_str || !phase2_ca_cert_str[0]);
|
||||
RETURN_STR_TO_FREE (phase2_ca_cert_str);
|
||||
}
|
||||
|
||||
|
|
@ -1996,6 +2033,7 @@ _get_fcn_802_1x_phase2_client_cert (ARGS_GET_FCN)
|
|||
break;
|
||||
}
|
||||
|
||||
NM_SET_OUT (out_is_default, !cert_str || !cert_str[0]);
|
||||
RETURN_STR_TO_FREE (cert_str);
|
||||
}
|
||||
|
||||
|
|
@ -2003,9 +2041,13 @@ static gconstpointer
|
|||
_get_fcn_802_1x_password_raw (ARGS_GET_FCN)
|
||||
{
|
||||
NMSetting8021x *s_8021X = NM_SETTING_802_1X (setting);
|
||||
char *str;
|
||||
|
||||
RETURN_UNSUPPORTED_GET_TYPE ();
|
||||
RETURN_STR_TO_FREE (bytes_to_string (nm_setting_802_1x_get_password_raw (s_8021X)));
|
||||
|
||||
str = bytes_to_string (nm_setting_802_1x_get_password_raw (s_8021X));
|
||||
NM_SET_OUT (out_is_default, !str || !str[0]);
|
||||
RETURN_STR_TO_FREE (str);
|
||||
}
|
||||
|
||||
static gconstpointer
|
||||
|
|
@ -2033,6 +2075,7 @@ _get_fcn_802_1x_private_key (ARGS_GET_FCN)
|
|||
break;
|
||||
}
|
||||
|
||||
NM_SET_OUT (out_is_default, !key_str || !key_str[0]);
|
||||
RETURN_STR_TO_FREE (key_str);
|
||||
}
|
||||
|
||||
|
|
@ -2061,6 +2104,7 @@ _get_fcn_802_1x_phase2_private_key (ARGS_GET_FCN)
|
|||
break;
|
||||
}
|
||||
|
||||
NM_SET_OUT (out_is_default, !key_str || !key_str[0]);
|
||||
RETURN_STR_TO_FREE (key_str);
|
||||
}
|
||||
|
||||
|
|
@ -2254,6 +2298,7 @@ _get_fcn_bond_options (ARGS_GET_FCN)
|
|||
}
|
||||
g_string_truncate (bond_options_s, bond_options_s->len-1); /* chop off trailing ',' */
|
||||
|
||||
NM_SET_OUT (out_is_default, bond_options_s->len == 0);
|
||||
RETURN_STR_TO_FREE (g_string_free (bond_options_s, FALSE));
|
||||
}
|
||||
|
||||
|
|
@ -2357,6 +2402,9 @@ _get_fcn_connection_permissions (ARGS_GET_FCN)
|
|||
if (nm_setting_connection_get_permission (s_con, i, &perm_type, &perm_item, NULL))
|
||||
g_string_append_printf (perm, "%s:%s,", perm_type, perm_item);
|
||||
}
|
||||
|
||||
NM_SET_OUT (out_is_default, perm->len == 0);
|
||||
|
||||
if (perm->len > 0) {
|
||||
g_string_truncate (perm, perm->len-1); /* remove trailing , */
|
||||
RETURN_STR_TO_FREE (g_string_free (perm, FALSE));
|
||||
|
|
@ -2636,9 +2684,11 @@ _get_fcn_connection_metered (ARGS_GET_FCN)
|
|||
break;
|
||||
case NM_METERED_UNKNOWN:
|
||||
default:
|
||||
NM_SET_OUT (out_is_default, TRUE);
|
||||
s = N_("unknown");
|
||||
break;
|
||||
}
|
||||
|
||||
if (get_type == NM_META_ACCESSOR_GET_TYPE_PRETTY)
|
||||
return _(s);
|
||||
return s;
|
||||
|
|
@ -3056,12 +3106,14 @@ _get_fcn_infiniband_p_key (ARGS_GET_FCN)
|
|||
|
||||
p_key = nm_setting_infiniband_get_p_key (s_infiniband);
|
||||
if (p_key == -1) {
|
||||
NM_SET_OUT (out_is_default, TRUE);
|
||||
if (get_type != NM_META_ACCESSOR_GET_TYPE_PRETTY)
|
||||
return "default";
|
||||
else
|
||||
return _("default");
|
||||
} else
|
||||
RETURN_STR_TO_FREE (g_strdup_printf ("0x%04x", p_key));
|
||||
}
|
||||
|
||||
RETURN_STR_TO_FREE (g_strdup_printf ("0x%04x", p_key));
|
||||
}
|
||||
|
||||
static gconstpointer
|
||||
|
|
@ -3088,6 +3140,7 @@ _get_fcn_ip_config_addresses (ARGS_GET_FCN)
|
|||
nm_ip_address_get_prefix (addr));
|
||||
}
|
||||
|
||||
NM_SET_OUT (out_is_default, num_addresses == 0);
|
||||
RETURN_STR_TO_FREE (g_string_free (printable, FALSE));
|
||||
}
|
||||
|
||||
|
|
@ -3159,6 +3212,7 @@ _get_fcn_ip_config_routes (ARGS_GET_FCN)
|
|||
}
|
||||
}
|
||||
|
||||
NM_SET_OUT (out_is_default, num_routes == 0);
|
||||
RETURN_STR_TO_FREE (g_string_free (printable, FALSE));
|
||||
}
|
||||
|
||||
|
|
@ -3671,6 +3725,7 @@ _get_fcn_olpc_mesh_ssid (ARGS_GET_FCN)
|
|||
g_bytes_get_size (ssid));
|
||||
}
|
||||
|
||||
NM_SET_OUT (out_is_default, !ssid_str);
|
||||
RETURN_STR_TO_FREE (ssid_str);
|
||||
}
|
||||
|
||||
|
|
@ -3726,6 +3781,7 @@ _get_fcn_tc_config_qdiscs (ARGS_GET_FCN)
|
|||
}
|
||||
}
|
||||
|
||||
NM_SET_OUT (out_is_default, num_qdiscs == 0);
|
||||
RETURN_STR_TO_FREE (g_string_free (printable, FALSE));
|
||||
}
|
||||
|
||||
|
|
@ -3802,6 +3858,7 @@ _get_fcn_tc_config_tfilters (ARGS_GET_FCN)
|
|||
}
|
||||
}
|
||||
|
||||
NM_SET_OUT (out_is_default, num_tfilters == 0);
|
||||
RETURN_STR_TO_FREE (g_string_free (printable, FALSE));
|
||||
}
|
||||
|
||||
|
|
@ -3946,6 +4003,7 @@ _get_fcn_team_link_watchers (ARGS_GET_FCN)
|
|||
}
|
||||
}
|
||||
|
||||
NM_SET_OUT (out_is_default, num_watchers == 0);
|
||||
RETURN_STR_TO_FREE (g_string_free (printable, FALSE));
|
||||
}
|
||||
|
||||
|
|
@ -4019,6 +4077,7 @@ _get_fcn_team_port_link_watchers (ARGS_GET_FCN)
|
|||
}
|
||||
}
|
||||
|
||||
NM_SET_OUT (out_is_default, num_watchers == 0);
|
||||
RETURN_STR_TO_FREE (g_string_free (printable, FALSE));
|
||||
}
|
||||
|
||||
|
|
@ -4071,24 +4130,39 @@ static gconstpointer
|
|||
_get_fcn_vlan_flags (ARGS_GET_FCN)
|
||||
{
|
||||
NMSettingVlan *s_vlan = NM_SETTING_VLAN (setting);
|
||||
guint32 flags;
|
||||
|
||||
RETURN_UNSUPPORTED_GET_TYPE ();
|
||||
RETURN_STR_TO_FREE (vlan_flags_to_string (nm_setting_vlan_get_flags (s_vlan), get_type));
|
||||
|
||||
flags = nm_setting_vlan_get_flags (s_vlan);
|
||||
NM_SET_OUT (out_is_default, flags == 0);
|
||||
RETURN_STR_TO_FREE (vlan_flags_to_string (flags, get_type));
|
||||
}
|
||||
|
||||
static gconstpointer
|
||||
_get_fcn_vlan_ingress_priority_map (ARGS_GET_FCN)
|
||||
{
|
||||
NMSettingVlan *s_vlan = NM_SETTING_VLAN (setting);
|
||||
char *str;
|
||||
|
||||
RETURN_UNSUPPORTED_GET_TYPE ();
|
||||
RETURN_STR_TO_FREE (vlan_priorities_to_string (s_vlan, NM_VLAN_INGRESS_MAP));
|
||||
|
||||
str = vlan_priorities_to_string (s_vlan, NM_VLAN_INGRESS_MAP);
|
||||
NM_SET_OUT (out_is_default, !str || !str[0]);
|
||||
RETURN_STR_TO_FREE (str);
|
||||
}
|
||||
|
||||
static gconstpointer
|
||||
_get_fcn_vlan_egress_priority_map (ARGS_GET_FCN)
|
||||
{
|
||||
NMSettingVlan *s_vlan = NM_SETTING_VLAN (setting);
|
||||
char *str;
|
||||
|
||||
RETURN_UNSUPPORTED_GET_TYPE ();
|
||||
RETURN_STR_TO_FREE (vlan_priorities_to_string (s_vlan, NM_VLAN_EGRESS_MAP));
|
||||
|
||||
str = vlan_priorities_to_string (s_vlan, NM_VLAN_EGRESS_MAP);
|
||||
NM_SET_OUT (out_is_default, !str || !str[0]);
|
||||
RETURN_STR_TO_FREE (str);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
@ -4211,7 +4285,7 @@ _get_fcn_vpn_data (ARGS_GET_FCN)
|
|||
|
||||
data_item_str = g_string_new (NULL);
|
||||
nm_setting_vpn_foreach_data_item (s_vpn, &vpn_data_item, data_item_str);
|
||||
|
||||
NM_SET_OUT (out_is_default, data_item_str->len == 0);
|
||||
RETURN_STR_TO_FREE (g_string_free (data_item_str, FALSE));
|
||||
}
|
||||
|
||||
|
|
@ -4225,7 +4299,7 @@ _get_fcn_vpn_secrets (ARGS_GET_FCN)
|
|||
|
||||
secret_str = g_string_new (NULL);
|
||||
nm_setting_vpn_foreach_secret (s_vpn, &vpn_data_item, secret_str);
|
||||
|
||||
NM_SET_OUT (out_is_default, secret_str->len == 0);
|
||||
RETURN_STR_TO_FREE (g_string_free (secret_str, FALSE));
|
||||
}
|
||||
|
||||
|
|
@ -4367,6 +4441,7 @@ _get_fcn_wireless_ssid (ARGS_GET_FCN)
|
|||
g_bytes_get_size (ssid));
|
||||
}
|
||||
|
||||
NM_SET_OUT (out_is_default, !ssid_str || !ssid_str[0]);
|
||||
RETURN_STR_TO_FREE (ssid_str);
|
||||
}
|
||||
|
||||
|
|
@ -4436,6 +4511,7 @@ _get_fcn_wireless_security_wep_key (ARGS_GET_FCN)
|
|||
index = property_info->property_name[7] - '0';
|
||||
|
||||
key = g_strdup (nm_setting_wireless_security_get_wep_key (s_wireless_sec, index));
|
||||
NM_SET_OUT (out_is_default, !key);
|
||||
RETURN_STR_TO_FREE (key);
|
||||
}
|
||||
|
||||
|
|
@ -7864,8 +7940,10 @@ _meta_type_property_info_get_fcn (const NMMetaAbstractInfo *abstract_info,
|
|||
nm_assert (out_to_free);
|
||||
|
||||
if ( info->is_secret
|
||||
&& !NM_FLAGS_HAS (get_flags, NM_META_ACCESSOR_GET_FLAGS_SHOW_SECRETS))
|
||||
&& !NM_FLAGS_HAS (get_flags, NM_META_ACCESSOR_GET_FLAGS_SHOW_SECRETS)) {
|
||||
NM_SET_OUT (out_is_default, TRUE);
|
||||
return _get_text_hidden (get_type);
|
||||
}
|
||||
|
||||
return info->property_type->get_fcn (info,
|
||||
environment,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue