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.
This commit is contained in:
Jehan 2020-06-10 02:25:35 +02:00
parent 588ae66e52
commit ee79c7b294
1 changed files with 21 additions and 7 deletions

View File

@ -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);
}