Commit 0ee3f235 authored by Thomas Haller's avatar Thomas Haller Committed by Dan Winship

tui: use nm_remote_settings_get_connection_by_id()

Signed-off-by: Thomas Haller's avatarThomas Haller <thaller@redhat.com>
parent f76934de
......@@ -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]);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment