Exemplo n.º 1
0
static void
realize_start_notify (NMDevice *device, const NMPlatformLink *plink)
{
	NMDeviceGeneric *self = NM_DEVICE_GENERIC (device);
	NMDeviceGenericPrivate *priv = NM_DEVICE_GENERIC_GET_PRIVATE (self);
	int ifindex;

	NM_DEVICE_CLASS (nm_device_generic_parent_class)->realize_start_notify (device, plink);

	g_clear_pointer (&priv->type_description, g_free);
	ifindex = nm_device_get_ip_ifindex (NM_DEVICE (self));
	if (ifindex > 0)
		priv->type_description = g_strdup (nm_platform_link_get_type_name (NM_PLATFORM_GET, ifindex));
}
static void
constructed (GObject *object)
{
	NMDeviceGeneric *self = NM_DEVICE_GENERIC (object);
	NMDeviceGenericPrivate *priv = NM_DEVICE_GENERIC_GET_PRIVATE (self);

	if (!priv->type_description) {
		int ifindex = nm_device_get_ip_ifindex (NM_DEVICE (self));

		if (ifindex != 0)
			priv->type_description = g_strdup (nm_platform_link_get_type_name (NM_PLATFORM_GET, ifindex));
	}

	G_OBJECT_CLASS (nm_device_generic_parent_class)->constructed (object);
}