mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-18 22:40:33 +01:00
tui: use nm_remote_settings_get_connection_by_id()
Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
parent
f76934de15
commit
0ee3f23534
2 changed files with 6 additions and 28 deletions
|
|
@ -576,22 +576,12 @@ nmt_connect_connection_list_get_connection (NmtConnectConnectionList *list,
|
|||
NmtConnectConnection *nmtconn = NULL;
|
||||
NMConnection *conn = NULL;
|
||||
|
||||
g_return_val_if_fail (identifier, FALSE);
|
||||
|
||||
if (nm_utils_is_uuid (identifier))
|
||||
conn = NM_CONNECTION (nm_remote_settings_get_connection_by_uuid (nm_settings, identifier));
|
||||
else {
|
||||
GSList *conns, *iter;
|
||||
|
||||
conns = nm_remote_settings_list_connections (nm_settings);
|
||||
for (iter = conns; iter; iter = iter->next) {
|
||||
NMConnection *candidate = iter->data;
|
||||
|
||||
if (!strcmp (identifier, nm_connection_get_id (candidate))) {
|
||||
conn = candidate;
|
||||
break;
|
||||
}
|
||||
}
|
||||
g_slist_free (conns);
|
||||
}
|
||||
if (!conn)
|
||||
conn = NM_CONNECTION (nm_remote_settings_get_connection_by_id (nm_settings, identifier));
|
||||
|
||||
for (diter = priv->nmt_devices; diter; diter = diter->next) {
|
||||
nmtdev = diter->data;
|
||||
|
|
|
|||
|
|
@ -500,20 +500,8 @@ nmtui_edit (int argc, char **argv)
|
|||
if (argc == 2) {
|
||||
if (nm_utils_is_uuid (argv[1]))
|
||||
conn = NM_CONNECTION (nm_remote_settings_get_connection_by_uuid (nm_settings, argv[1]));
|
||||
else {
|
||||
GSList *conns, *iter;
|
||||
|
||||
conns = nm_remote_settings_list_connections (nm_settings);
|
||||
for (iter = conns; iter; iter = iter->next) {
|
||||
NMConnection *candidate = iter->data;
|
||||
|
||||
if (!strcmp (argv[1], nm_connection_get_id (candidate))) {
|
||||
conn = candidate;
|
||||
break;
|
||||
}
|
||||
}
|
||||
g_slist_free (conns);
|
||||
}
|
||||
if (!conn)
|
||||
conn = NM_CONNECTION (nm_remote_settings_get_connection_by_id (nm_settings, argv[1]));
|
||||
|
||||
if (!conn) {
|
||||
nmt_newt_message_dialog ("%s: no such connection '%s'\n", argv[0], argv[1]);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue