From 867c3cdae09ed75edd353a52452b0fbf6b830aef Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Wed, 18 Dec 2013 13:21:51 -0500 Subject: [PATCH] tui: fix the error-on-startup cases --- tui/nmt-connect-connection-list.c | 10 ++++++---- tui/nmtui-connect.c | 1 + tui/nmtui-edit.c | 5 +++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/tui/nmt-connect-connection-list.c b/tui/nmt-connect-connection-list.c index b103dd0283..261a4a5780 100644 --- a/tui/nmt-connect-connection-list.c +++ b/tui/nmt-connect-connection-list.c @@ -779,14 +779,16 @@ nmt_connect_connection_list_activate_async (NmtConnectConnectionList *list, goto activate; } - if (!conn && !nmtdev->device && !strcmp (identifier, nm_device_get_ip_iface (nmtdev->device))) { + if (!conn && nmtdev->device && !strcmp (identifier, nm_device_get_ip_iface (nmtdev->device))) { nmtconn = nmtdev->conns->data; goto activate; } } - g_printerr ("%s: no such connection '%s'\n", g_get_prgname (), identifier); - exit (1); + g_simple_async_report_error_in_idle (G_OBJECT (list), callback, user_data, + NM_CLIENT_ERROR, NM_CLIENT_ERROR_UNKNOWN, + _("No such connection '%s'"), identifier); + return; activate: activate_nmt_connection_async (list, nmtconn, callback, user_data); @@ -807,5 +809,5 @@ nmt_connect_connection_list_activate_finish (NmtConnectConnectionList *list, GAsyncResult *result, GError **error) { - return g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error); + return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error); } diff --git a/tui/nmtui-connect.c b/tui/nmtui-connect.c index 9307100a25..76b1400479 100644 --- a/tui/nmtui-connect.c +++ b/tui/nmtui-connect.c @@ -71,6 +71,7 @@ nmt_connect_connection (const char *identifier) if (!nmt_sync_op_wait_boolean (&op, &error)) { nmt_newt_error_dialog (_("Could not activate connection: %s"), error->message); g_error_free (error); + nmtui_quit (); } g_object_unref (list); } diff --git a/tui/nmtui-edit.c b/tui/nmtui-edit.c index f7ca4caa0d..cda9b8c0fe 100644 --- a/tui/nmtui-edit.c +++ b/tui/nmtui-edit.c @@ -517,8 +517,9 @@ nmtui_edit (int argc, char **argv) } if (!conn) { - g_printerr ("%s: no such connection '%s'\n", argv[0], argv[1]); - exit (1); + nmt_newt_error_dialog ("%s: no such connection '%s'\n", argv[0], argv[1]); + nmtui_quit (); + return; } nmt_edit_connection (conn);