mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-06 12:00:17 +01:00
nmtui: fix deletion confirmation with ESC key press
When deleting a profile, the confirmation dialog shows "Cancel" and "Delete" buttons. ESC key should do nothing, but in some distributions like Debian and Ubuntu newt has a downstream patch that enables it (see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=584098). In that case, when pressing ESC the return value of the dialog is not "Cancel" (1) or "Delete" (2), but the "otherwise" value (0). Fix it by not checking if "Cancel" is pressed. Instead, check if "Delete" was pressed, and continue deleting only in that case. Also, fix the doc comment that incorrectly says that the dialog returns 0/1 for the buttons, it is 1/2.
This commit is contained in:
parent
b9f7b1a17b
commit
8f5a4f957f
2 changed files with 2 additions and 2 deletions
|
|
@ -282,7 +282,7 @@ nmt_newt_message_dialog(const char *message, ...)
|
|||
* Displays the given message in a dialog box with two buttons with
|
||||
* the indicated labels, and waits for the user to click one.
|
||||
*
|
||||
* Returns: which button was clicked: 0 for @button1 or 1 for @button2
|
||||
* Returns: which button was clicked: 1 for @button1, 2 for @button2 or 0 otherwise
|
||||
*/
|
||||
int
|
||||
nmt_newt_choice_dialog(const char *button1, const char *button2, const char *message, ...)
|
||||
|
|
|
|||
|
|
@ -511,7 +511,7 @@ nmt_remove_connection(NMRemoteConnection *connection)
|
|||
_("Delete"),
|
||||
_("Are you sure you want to delete the connection '%s'?"),
|
||||
nm_connection_get_id(NM_CONNECTION(connection)));
|
||||
if (choice == 1)
|
||||
if (choice != 2)
|
||||
return;
|
||||
|
||||
g_object_ref(connection);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue