libnm: refactor some NMSetting to use direct properties for int64

This commit is contained in:
Thomas Haller
2021-12-28 10:50:05 +01:00
parent 72e523830c
commit 1d4a80cf7f
2 changed files with 8 additions and 14 deletions

View File

@@ -5833,6 +5833,13 @@ _nm_sett_info_property_override_create_array_ip_config(int addr_family)
.direct_offset =
NM_STRUCT_OFFSET_ENSURE_TYPE(guint32, NMSettingIPConfigPrivate, route_table));
_nm_properties_override_gobj(
properties_override,
obj_properties[PROP_ROUTE_METRIC],
&nm_sett_info_propert_type_direct_int64,
.direct_offset =
NM_STRUCT_OFFSET_ENSURE_TYPE(gint64, NMSettingIPConfigPrivate, route_metric));
_nm_properties_override_gobj(
properties_override,
obj_properties[PROP_IGNORE_AUTO_DNS],
@@ -5936,9 +5943,6 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
(NMUtilsCopyFunc) nm_ip_route_dup,
(GDestroyNotify) nm_ip_route_unref));
break;
case PROP_ROUTE_METRIC:
g_value_set_int64(value, priv->route_metric);
break;
case PROP_IGNORE_AUTO_ROUTES:
g_value_set_boolean(value, nm_setting_ip_config_get_ignore_auto_routes(setting));
break;
@@ -6028,9 +6032,6 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
(NMUtilsCopyFunc) nm_ip_route_dup,
(GDestroyNotify) nm_ip_route_unref);
break;
case PROP_ROUTE_METRIC:
priv->route_metric = g_value_get_int64(value);
break;
case PROP_IGNORE_AUTO_ROUTES:
priv->ignore_auto_routes = g_value_get_boolean(value);
break;
@@ -6074,7 +6075,6 @@ _nm_setting_ip_config_private_init(gpointer self, NMSettingIPConfigPrivate *priv
priv->dns_search = g_ptr_array_new_with_free_func(g_free);
priv->addresses = g_ptr_array_new_with_free_func((GDestroyNotify) nm_ip_address_unref);
priv->routes = g_ptr_array_new_with_free_func((GDestroyNotify) nm_ip_route_unref);
priv->route_metric = -1;
}
static void

View File

@@ -390,13 +390,7 @@ _nm_setting_class_commit(NMSettingClass *setting_class,
goto has_property_type;
}
if (vtype == G_TYPE_INT64)
p->property_type = NM_SETT_INFO_PROPERT_TYPE_GPROP(
G_VARIANT_TYPE_INT64,
.compare_fcn = _nm_setting_property_compare_fcn_default,
.from_dbus_fcn = _nm_setting_property_from_dbus_fcn_gprop,
.from_dbus_is_full = TRUE);
else if (vtype == G_TYPE_STRV)
if (vtype == G_TYPE_STRV)
p->property_type = NM_SETT_INFO_PROPERT_TYPE_GPROP(
G_VARIANT_TYPE_STRING_ARRAY,
.compare_fcn = _nm_setting_property_compare_fcn_default,