Issue #263 - Add a "Save Keyboard Shortcuts Now" button...

...to the Configure Keyboard Shortcuts dialog

Add the button, based on an old patch from Sven Neumann, and make the
buttons in the keyboard shortcuts and input devices dialogs look and
behave the same.
This commit is contained in:
Michael Natterer 2019-05-29 16:12:21 +02:00
parent a6393e6c55
commit 04b69e2494
2 changed files with 43 additions and 10 deletions

View File

@ -35,6 +35,9 @@
#include "gimp-intl.h"
#define RESPONSE_SAVE 1
/* local function prototypes */
static void input_devices_dialog_response (GtkWidget *dialog,
@ -59,16 +62,11 @@ input_devices_dialog_new (Gimp *gimp)
gimp_standard_help_func,
GIMP_HELP_INPUT_DEVICES,
_("_Save"), RESPONSE_SAVE,
_("_Close"), GTK_RESPONSE_CLOSE,
_("_Save"), GTK_RESPONSE_OK,
NULL);
gimp_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
GTK_RESPONSE_OK,
GTK_RESPONSE_CLOSE,
-1);
g_signal_connect (dialog, "response",
G_CALLBACK (input_devices_dialog_response),
gimp);
@ -93,7 +91,7 @@ input_devices_dialog_response (GtkWidget *dialog,
{
switch (response_id)
{
case GTK_RESPONSE_OK:
case RESPONSE_SAVE:
gimp_devices_save (gimp, TRUE);
break;

View File

@ -30,11 +30,25 @@
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpuimanager.h"
#include "menus/menus.h"
#include "keyboard-shortcuts-dialog.h"
#include "gimp-intl.h"
#define RESPONSE_SAVE 1
/* local function prototypes */
static void keyboard_shortcuts_dialog_response (GtkWidget *dialog,
gint response,
Gimp *gimp);
/* public functions */
GtkWidget *
keyboard_shortcuts_dialog_new (Gimp *gimp)
{
@ -52,13 +66,14 @@ keyboard_shortcuts_dialog_new (Gimp *gimp)
gimp_standard_help_func,
GIMP_HELP_KEYBOARD_SHORTCUTS,
_("_Close"), GTK_RESPONSE_OK,
_("_Save"), RESPONSE_SAVE,
_("_Close"), GTK_RESPONSE_CLOSE,
NULL);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_widget_destroy),
NULL);
G_CALLBACK (keyboard_shortcuts_dialog_response),
gimp);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
@ -85,3 +100,23 @@ keyboard_shortcuts_dialog_new (Gimp *gimp)
return dialog;
}
/* private functions */
static void
keyboard_shortcuts_dialog_response (GtkWidget *dialog,
gint response,
Gimp *gimp)
{
switch (response)
{
case RESPONSE_SAVE:
menus_save (gimp, TRUE);
break;
default:
gtk_widget_destroy (dialog);
break;
}
}