summaryrefslogtreecommitdiff
path: root/src/devices/nm-device-generic.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-05-15 15:00:07 +0200
committerJiří Klimeš <jklimes@redhat.com>2015-06-19 12:10:51 +0200
commitddfa3544004169716a75a3d6b734e29332b47015 (patch)
tree2ed608fa85e46f3e22b4c85226f4872520f3a8da /src/devices/nm-device-generic.c
parent517e9fa0f062e286f893f41770d0562c4baf0c51 (diff)
device: add nm_device_get_type_description() function
Add a function to get a concise representation of the device type. libnm already has nm_device_get_type_description() for that and it is shown by nmcli -f GENERAL.TYPE device show Reimplement that function for nm-core. Just take care that the two implementations don't diverge. (cherry picked from commit e9e9d44468de460afaa11865bae321145b78212e)
Diffstat (limited to 'src/devices/nm-device-generic.c')
-rw-r--r--src/devices/nm-device-generic.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/devices/nm-device-generic.c b/src/devices/nm-device-generic.c
index 8b328e07fe..5841d834ff 100644
--- a/src/devices/nm-device-generic.c
+++ b/src/devices/nm-device-generic.c
@@ -54,6 +54,14 @@ get_generic_capabilities (NMDevice *dev)
return NM_DEVICE_CAP_NONE;
}
+static const char *
+get_type_description (NMDevice *device)
+{
+ if (NM_DEVICE_GENERIC_GET_PRIVATE (device)->type_description)
+ return NM_DEVICE_GENERIC_GET_PRIVATE (device)->type_description;
+ return NM_DEVICE_CLASS (nm_device_generic_parent_class)->get_type_description (device);
+}
+
static gboolean
check_connection_compatible (NMDevice *device, NMConnection *connection)
{
@@ -184,6 +192,7 @@ nm_device_generic_class_init (NMDeviceGenericClass *klass)
object_class->set_property = set_property;
parent_class->get_generic_capabilities = get_generic_capabilities;
+ parent_class->get_type_description = get_type_description;
parent_class->check_connection_compatible = check_connection_compatible;
parent_class->update_connection = update_connection;