file dialog: Handle Escape better
authorMatthias Clasen <mclasen@redhat.com>
Thu, 24 Nov 2022 15:29:43 +0000 (10:29 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 24 Nov 2022 15:29:43 +0000 (10:29 -0500)
Closing the dialog by hitting Escape should
have the same effect as clicking the cancel
button. Make it so.

gtk/gtkfiledialog.c

index a1ad1c9731720ec16794e87ea79cc9cf5d3d2bf6..410da0b099ad8b10a69589a0fa9674800202f429 100644 (file)
@@ -628,7 +628,8 @@ G_GNUC_END_IGNORE_DEPRECATIONS
     }
   else if (response == GTK_RESPONSE_CLOSE)
     g_task_return_new_error (task, GTK_DIALOG_ERROR, GTK_DIALOG_ERROR_ABORTED, "Aborted by application");
-  else if (response == GTK_RESPONSE_CANCEL)
+  else if (response == GTK_RESPONSE_CANCEL ||
+           response == GTK_RESPONSE_DELETE_EVENT)
     g_task_return_new_error (task, GTK_DIALOG_ERROR, GTK_DIALOG_ERROR_CANCELLED, "Cancelled by user");
   else
     g_task_return_new_error (task, GTK_DIALOG_ERROR, GTK_DIALOG_ERROR_FAILED, "Unknown failure (%d)", response);