diff options
author | Dan Winship <danw@gnome.org> | 2014-09-23 11:18:37 -0400 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2014-10-08 10:20:18 -0400 |
commit | 27650c219892e40ac28e4433d9ece3f3e51d0129 (patch) | |
tree | d0c0294fc1df3f6e79969c076a9db78919e37480 | |
parent | 754a5d01f09df04ae38d884bfd8191271e14cd7e (diff) | |
download | NetworkManager-27650c219892e40ac28e4433d9ece3f3e51d0129.tar.gz |
tui: show orphaned slaves in the connection editor list
If a master is deleted but its slaves are left behind, show those
slaves in the appropriate part of the connection list, so they can be
deleted. (This code is just copied from nm-connection-editor.)
-rw-r--r-- | clients/tui/nmtui-edit.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/clients/tui/nmtui-edit.c b/clients/tui/nmtui-edit.c index 7065cbe4c3..5f9335d337 100644 --- a/clients/tui/nmtui-edit.c +++ b/clients/tui/nmtui-edit.c @@ -70,11 +70,35 @@ edit_connection_list_filter (NmtEditConnectionList *list, gpointer user_data) { NMSettingConnection *s_con; + const char *master, *slave_type; + const char *uuid, *ifname; + GSList *conns, *iter; + gboolean found_master = FALSE; s_con = nm_connection_get_setting_connection (connection); g_return_val_if_fail (s_con != NULL, FALSE); - return (nm_setting_connection_get_slave_type (s_con) == NULL); + master = nm_setting_connection_get_master (s_con); + if (!master) + return TRUE; + slave_type = nm_setting_connection_get_slave_type (s_con); + if ( g_strcmp0 (slave_type, NM_SETTING_BOND_SETTING_NAME) != 0 + && g_strcmp0 (slave_type, NM_SETTING_TEAM_SETTING_NAME) != 0 + && g_strcmp0 (slave_type, NM_SETTING_BRIDGE_SETTING_NAME) != 0) + return TRUE; + + conns = nm_remote_settings_list_connections (nm_settings); + for (iter = conns; iter; iter = iter->next) { + uuid = nm_connection_get_uuid (iter->data); + ifname = nm_connection_get_interface_name (iter->data); + if (!g_strcmp0 (master, uuid) || !g_strcmp0 (master, ifname)) { + found_master = TRUE; + break; + } + } + g_slist_free (conns); + + return !found_master; } static NmtNewtForm * |