From 27650c219892e40ac28e4433d9ece3f3e51d0129 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Tue, 23 Sep 2014 11:18:37 -0400 Subject: [PATCH] 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.) --- clients/tui/nmtui-edit.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) 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 *