libnm-glib: add :parent property for VLAN devices
This commit is contained in:
@@ -183,6 +183,7 @@ global:
|
||||
nm_device_vlan_error_quark;
|
||||
nm_device_vlan_get_carrier;
|
||||
nm_device_vlan_get_hw_address;
|
||||
nm_device_vlan_get_parent;
|
||||
nm_device_vlan_get_type;
|
||||
nm_device_vlan_get_vlan_id;
|
||||
nm_device_vlan_new;
|
||||
|
@@ -42,6 +42,7 @@ typedef struct {
|
||||
|
||||
char *hw_address;
|
||||
gboolean carrier;
|
||||
NMDevice *parent;
|
||||
guint vlan_id;
|
||||
} NMDeviceVlanPrivate;
|
||||
|
||||
@@ -49,6 +50,7 @@ enum {
|
||||
PROP_0,
|
||||
PROP_HW_ADDRESS,
|
||||
PROP_CARRIER,
|
||||
PROP_PARENT,
|
||||
PROP_VLAN_ID,
|
||||
|
||||
LAST_PROP
|
||||
@@ -131,6 +133,23 @@ nm_device_vlan_get_carrier (NMDeviceVlan *device)
|
||||
return NM_DEVICE_VLAN_GET_PRIVATE (device)->carrier;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_device_vlan_get_parent:
|
||||
* @device: a #NMDeviceVlan
|
||||
*
|
||||
* Returns: the device's parent device
|
||||
*
|
||||
* Since: 1.0
|
||||
**/
|
||||
NMDevice *
|
||||
nm_device_vlan_get_parent (NMDeviceVlan *device)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_DEVICE_VLAN (device), FALSE);
|
||||
|
||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
||||
return NM_DEVICE_VLAN_GET_PRIVATE (device)->parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_device_vlan_get_vlan_id:
|
||||
* @device: a #NMDeviceVlan
|
||||
@@ -231,6 +250,7 @@ register_properties (NMDeviceVlan *device)
|
||||
const NMPropertiesInfo property_info[] = {
|
||||
{ NM_DEVICE_VLAN_HW_ADDRESS, &priv->hw_address },
|
||||
{ NM_DEVICE_VLAN_CARRIER, &priv->carrier },
|
||||
{ NM_DEVICE_VLAN_PARENT, &priv->parent, NULL, NM_TYPE_DEVICE },
|
||||
{ NM_DEVICE_VLAN_VLAN_ID, &priv->vlan_id },
|
||||
{ NULL },
|
||||
};
|
||||
@@ -256,6 +276,7 @@ dispose (GObject *object)
|
||||
{
|
||||
NMDeviceVlanPrivate *priv = NM_DEVICE_VLAN_GET_PRIVATE (object);
|
||||
|
||||
g_clear_object (&priv->parent);
|
||||
g_clear_object (&priv->proxy);
|
||||
|
||||
G_OBJECT_CLASS (nm_device_vlan_parent_class)->dispose (object);
|
||||
@@ -288,6 +309,9 @@ get_property (GObject *object,
|
||||
case PROP_CARRIER:
|
||||
g_value_set_boolean (value, nm_device_vlan_get_carrier (device));
|
||||
break;
|
||||
case PROP_PARENT:
|
||||
g_value_set_object (value, nm_device_vlan_get_parent (device));
|
||||
break;
|
||||
case PROP_VLAN_ID:
|
||||
g_value_set_uint (value, nm_device_vlan_get_vlan_id (device));
|
||||
break;
|
||||
@@ -340,6 +364,20 @@ nm_device_vlan_class_init (NMDeviceVlanClass *vlan_class)
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* NMDeviceVlan:parent:
|
||||
*
|
||||
* The devices's parent device.
|
||||
*
|
||||
* Since: 1.0
|
||||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_PARENT,
|
||||
g_param_spec_object (NM_DEVICE_VLAN_PARENT, "", "",
|
||||
NM_TYPE_DEVICE,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* NMDeviceVlan:vlan-id:
|
||||
*
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright 2012 Red Hat, Inc.
|
||||
* Copyright 2012 - 2014 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef NM_DEVICE_VLAN_H
|
||||
@@ -55,6 +55,7 @@ GQuark nm_device_vlan_error_quark (void);
|
||||
|
||||
#define NM_DEVICE_VLAN_HW_ADDRESS "hw-address"
|
||||
#define NM_DEVICE_VLAN_CARRIER "carrier"
|
||||
#define NM_DEVICE_VLAN_PARENT "parent"
|
||||
#define NM_DEVICE_VLAN_VLAN_ID "vlan-id"
|
||||
|
||||
typedef struct {
|
||||
@@ -79,6 +80,8 @@ GObject *nm_device_vlan_new (DBusGConnection *connection, const char *path);
|
||||
|
||||
const char * nm_device_vlan_get_hw_address (NMDeviceVlan *device);
|
||||
gboolean nm_device_vlan_get_carrier (NMDeviceVlan *device);
|
||||
NM_AVAILABLE_IN_1_0
|
||||
NMDevice * nm_device_vlan_get_parent (NMDeviceVlan *device);
|
||||
guint nm_device_vlan_get_vlan_id (NMDeviceVlan *device);
|
||||
|
||||
G_END_DECLS
|
||||
|
Reference in New Issue
Block a user