352
354
switch (nm_device_get_device_type (device)) {
353
355
case NM_DEVICE_TYPE_BOND:
356
case NM_DEVICE_TYPE_BRIDGE:
354
357
case NM_DEVICE_TYPE_VLAN:
355
358
return g_strdup_printf ("%s (%s)", type_name, nm_device_get_iface (device));
528
531
names[num_devices] = NULL;
536
* nma_utils_get_connection_device_name:
537
* @connection: an #NMConnection for a virtual device type
539
* Returns the name that nma_utils_disambiguate_device_names() would
540
* return for the virtual device that would be created for @connection.
541
* Eg, "VLAN (eth1.1)".
543
* Returns: (transfer full): the name of @connection's device
546
nma_utils_get_connection_device_name (NMConnection *connection)
548
const char *iface, *type, *display_type;
549
NMSettingConnection *s_con;
551
iface = nm_connection_get_virtual_iface_name (connection);
552
g_return_val_if_fail (iface != NULL, NULL);
554
s_con = nm_connection_get_setting_connection (connection);
555
g_return_val_if_fail (s_con != NULL, NULL);
556
type = nm_setting_connection_get_connection_type (s_con);
558
if (!strcmp (type, NM_SETTING_BOND_SETTING_NAME))
559
display_type = _("Bond");
560
else if (!strcmp (type, NM_SETTING_BRIDGE_SETTING_NAME))
561
display_type = _("Bridge");
562
else if (!strcmp (type, NM_SETTING_VLAN_SETTING_NAME))
563
display_type = _("VLAN");
565
g_warning ("Unrecognized virtual device type '%s'", type);
569
return g_strdup_printf ("%s (%s)", display_type, iface);