コード例 #1
0
static void
constructed (GObject *object)
{
    NMDeviceGenericPrivate *priv = NM_DEVICE_GENERIC_GET_PRIVATE (object);

    G_OBJECT_CLASS (nm_device_generic_parent_class)->constructed (object);

    priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_DEVICE_GENERIC);
    register_properties (NM_DEVICE_GENERIC (object));
}
static void
dispose (GObject *object)
{
	NMDeviceGeneric *self = NM_DEVICE_GENERIC (object);
	NMDeviceGenericPrivate *priv = NM_DEVICE_GENERIC_GET_PRIVATE (self);

	g_clear_pointer (&priv->type_description, g_free);

	G_OBJECT_CLASS (nm_device_generic_parent_class)->dispose (object);
}
コード例 #3
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);
}
static void
set_property (GObject *object, guint prop_id,
              const GValue *value, GParamSpec *pspec)
{
	NMDeviceGeneric *self = NM_DEVICE_GENERIC (object);
	NMDeviceGenericPrivate *priv = NM_DEVICE_GENERIC_GET_PRIVATE (self);

	switch (prop_id) {
	case PROP_TYPE_DESCRIPTION:
		priv->type_description = g_value_dup_string (value);
		break;
	default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
		break;
	}
}
コード例 #6
0
static void
get_property (GObject *object,
              guint prop_id,
              GValue *value,
              GParamSpec *pspec)
{
	NMDeviceGeneric *self = NM_DEVICE_GENERIC (object);
	NMDeviceGenericPrivate *priv = NM_DEVICE_GENERIC_GET_PRIVATE (self);

	switch (prop_id) {
	case PROP_HW_ADDRESS:
		g_value_set_string (value, priv->hw_address);
		break;
	case PROP_TYPE_DESCRIPTION:
		g_value_set_string (value, get_type_description ((NMDevice *) self));
		break;
	default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
		break;
	}
}
コード例 #7
0
static void
constructed (GObject *object)
{
	NMDeviceGenericPrivate *priv = NM_DEVICE_GENERIC_GET_PRIVATE (object);
	NMDeviceType type;
	DBusGConnection *connection;
	const char *path, *interface;

	G_OBJECT_CLASS (nm_device_generic_parent_class)->constructed (object);

	g_object_get (object,
	              NM_OBJECT_DBUS_CONNECTION, &connection,
	              NM_OBJECT_DBUS_PATH, &path,
	              NULL);

	type = _nm_device_type_for_path (connection, path);
	interface = _device_type_to_interface (type);

	if (interface) {
		priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, interface);
		register_properties (NM_DEVICE_GENERIC (object));
	}
}
コード例 #8
0
static const char *
get_hw_address (NMDevice *device)
{
	return nm_device_generic_get_hw_address (NM_DEVICE_GENERIC (device));
}