summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2014-09-23 11:18:37 -0400
committerDan Winship <danw@redhat.com>2014-11-24 13:26:43 -0500
commit20a132d4aee046f7e8990a1e5866f9a9b24719b5 (patch)
treeebf1186c485b7e034a0a6965039444a356e01f4c
parent07b3bbc4809d7d34106a25742e931ee7f4c331cb (diff)
downloadNetworkManager-20a132d4aee046f7e8990a1e5866f9a9b24719b5.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.) (cherry picked from commit 27650c219892e40ac28e4433d9ece3f3e51d0129)
-rw-r--r--tui/nmtui-edit.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/tui/nmtui-edit.c b/tui/nmtui-edit.c
index 2a17b45405..22c68d22b6 100644
--- a/tui/nmtui-edit.c
+++ b/tui/nmtui-edit.c
@@ -70,11 +70,38 @@ 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) {
+ s_con = nm_connection_get_setting_connection (iter->data);
+ g_return_val_if_fail (s_con != NULL, FALSE);
+
+ uuid = nm_setting_connection_get_uuid (s_con);
+ ifname = nm_setting_connection_get_interface_name (s_con);
+ if (!g_strcmp0 (master, uuid) || !g_strcmp0 (master, ifname)) {
+ found_master = TRUE;
+ break;
+ }
+ }
+ g_slist_free (conns);
+
+ return !found_master;
}
static NmtNewtForm *