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.)
This commit is contained in:
Dan Winship 2014-09-23 11:18:37 -04:00
parent 754a5d01f0
commit 27650c2198

View file

@ -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 *