[gimp/gimp-2-10] Issue #263 - Add a "Save Keyboard Shortcuts Now" button...



commit b5159905e0ac266119f7e28bbcf5c126f08f868e
Author: Michael Natterer <mitch gimp org>
Date:   Wed May 29 16:12:21 2019 +0200

    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.
    
    (cherry picked from commit 04b69e2494ac0f54e71d9fef84ffdab45a0cfa7d)

 app/dialogs/input-devices-dialog.c      | 12 ++++------
 app/dialogs/keyboard-shortcuts-dialog.c | 41 ++++++++++++++++++++++++++++++---
 2 files changed, 43 insertions(+), 10 deletions(-)
---
diff --git a/app/dialogs/input-devices-dialog.c b/app/dialogs/input-devices-dialog.c
index 3cb4d17bbe..ace943139e 100644
--- a/app/dialogs/input-devices-dialog.c
+++ b/app/dialogs/input-devices-dialog.c
@@ -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);
 
-  gtk_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;
 
diff --git a/app/dialogs/keyboard-shortcuts-dialog.c b/app/dialogs/keyboard-shortcuts-dialog.c
index 3e4fc74de0..9fd354b51c 100644
--- a/app/dialogs/keyboard-shortcuts-dialog.c
+++ b/app/dialogs/keyboard-shortcuts-dialog.c
@@ -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;
+    }
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]