From ee79c7b294e7abf3810d3a6d4a24d91145fd5518 Mon Sep 17 00:00:00 2001 From: Jehan Date: Wed, 10 Jun 2020 02:25:35 +0200 Subject: [PATCH] app: "OK", "Cancel" and "Reset" buttons on "Input Devices" dialog. Rather than the "Save" and "Close" buttons which were very weird, if not misleading. When Aryeom was giving a course to students, several thought the buttons were broken because "nothing happened" when clicking "Save". So instead, "OK" will just save and exit (equivalent to click "Save" then "Close" on old GUI) as it is the common usage and should be doable in a single click. "Cancel" closes while resetting to how the settings were before opening the dialog. Finally "Reset" just reset the settings to how they were before opening, without closing the dialog. This also makes the buttons look/behave like the ones on Preferences, which is nice consistency-wise too. --- app/dialogs/input-devices-dialog.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/app/dialogs/input-devices-dialog.c b/app/dialogs/input-devices-dialog.c index ace943139e..135edb28df 100644 --- a/app/dialogs/input-devices-dialog.c +++ b/app/dialogs/input-devices-dialog.c @@ -35,9 +35,6 @@ #include "gimp-intl.h" -#define RESPONSE_SAVE 1 - - /* local function prototypes */ static void input_devices_dialog_response (GtkWidget *dialog, @@ -62,11 +59,18 @@ input_devices_dialog_new (Gimp *gimp) gimp_standard_help_func, GIMP_HELP_INPUT_DEVICES, - _("_Save"), RESPONSE_SAVE, - _("_Close"), GTK_RESPONSE_CLOSE, + _("_Reset"), GTK_RESPONSE_REJECT, + _("_Cancel"), GTK_RESPONSE_CANCEL, + _("_OK"), GTK_RESPONSE_OK, NULL); + gimp_dialog_set_alternative_button_order (GTK_DIALOG (dialog), + GTK_RESPONSE_REJECT, + GTK_RESPONSE_OK, + GTK_RESPONSE_CANCEL, + -1); + g_signal_connect (dialog, "response", G_CALLBACK (input_devices_dialog_response), gimp); @@ -91,12 +95,22 @@ input_devices_dialog_response (GtkWidget *dialog, { switch (response_id) { - case RESPONSE_SAVE: + case GTK_RESPONSE_OK: gimp_devices_save (gimp, TRUE); break; + case GTK_RESPONSE_DELETE_EVENT: + case GTK_RESPONSE_CANCEL: + gimp_devices_restore (gimp); + break; + + case GTK_RESPONSE_REJECT: + gimp_devices_restore (gimp); + return; + default: - gtk_widget_destroy (dialog); break; } + + gtk_widget_destroy (dialog); }