diff options
author | Dan Winship <danw@gnome.org> | 2014-10-03 16:50:18 -0400 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2014-10-08 10:20:18 -0400 |
commit | 66f19feef958f3b38bcfb7314f222be84abb3863 (patch) | |
tree | 08a524b39990c7104ccc8825df78aeb75c4a868d | |
parent | 27650c219892e40ac28e4433d9ece3f3e51d0129 (diff) | |
download | NetworkManager-66f19feef958f3b38bcfb7314f222be84abb3863.tar.gz |
tui: when deleting a bridge/bond/team, delete its slaves too (rh #1131574)
-rw-r--r-- | clients/tui/nmtui-edit.c | 51 |
1 files changed, 40 insertions, 11 deletions
diff --git a/clients/tui/nmtui-edit.c b/clients/tui/nmtui-edit.c index 5f9335d337..c0354784fe 100644 --- a/clients/tui/nmtui-edit.c +++ b/clients/tui/nmtui-edit.c @@ -486,20 +486,12 @@ connection_removed_signal (NMRemoteSettings *settings, } } -void -nmt_remove_connection (NMRemoteConnection *connection) +static void +remove_one_connection (NMRemoteConnection *connection) { ConnectionDeleteData data; - int choice; GError *error = NULL; - choice = nmt_newt_choice_dialog (_("Cancel"), - _("Delete"), - _("Are you sure you want to delete the connection '%s'?"), - nm_connection_get_id (NM_CONNECTION (connection))); - if (choice == 1) - return; - data.got_callback = data.got_signal = FALSE; nmt_sync_op_init (&data.op); @@ -509,7 +501,8 @@ nmt_remove_connection (NMRemoteConnection *connection) nm_remote_connection_delete_async (connection, NULL, connection_deleted_callback, &data); if (!nmt_sync_op_wait_boolean (&data.op, &error)) { - nmt_newt_message_dialog (_("Could not delete connection: %s"), + nmt_newt_message_dialog (_("Could not delete connection '%s': %s"), + nm_connection_get_id (NM_CONNECTION (connection)), error->message); g_error_free (error); } @@ -517,6 +510,42 @@ nmt_remove_connection (NMRemoteConnection *connection) g_signal_handlers_disconnect_by_func (nm_settings, G_CALLBACK (connection_removed_signal), &data); } +void +nmt_remove_connection (NMRemoteConnection *connection) +{ + GSList *conns, *iter; + NMRemoteConnection *slave; + NMSettingConnection *s_con; + const char *uuid, *iface, *master; + int choice; + + choice = nmt_newt_choice_dialog (_("Cancel"), + _("Delete"), + _("Are you sure you want to delete the connection '%s'?"), + nm_connection_get_id (NM_CONNECTION (connection))); + if (choice == 1) + return; + + g_object_ref (connection); + remove_one_connection (connection); + + uuid = nm_connection_get_uuid (NM_CONNECTION (connection)); + iface = nm_connection_get_interface_name (NM_CONNECTION (connection)); + + conns = nm_remote_settings_list_connections (nm_settings); + for (iter = conns; iter; iter = iter->next) { + slave = iter->data; + s_con = nm_connection_get_setting_connection (NM_CONNECTION (slave)); + master = nm_setting_connection_get_master (s_con); + if (master) { + if (!g_strcmp0 (master, uuid) || !g_strcmp0 (master, iface)) + remove_one_connection (slave); + } + } + g_slist_free (conns); + g_object_unref (connection); +} + NmtNewtForm * nmtui_edit (int argc, char **argv) { |