Applied modified patch from Michael J. Hammel which allows to remove all

2006-05-11  Michael Natterer  <mitch@gimp.org>

	Applied modified patch from Michael J. Hammel which allows to
	remove all keyboard shortcuts from the menus (fixes bug #331839):

	* app/dialogs/preferences-dialog.c: added "Remove all keyboard
	shortcuts" button to the "Interface" section.

	* app/menus/menus.[ch]: added menus_remove() which does the
	shortcut removal.
This commit is contained in:
Michael Natterer 2006-05-11 12:29:57 +00:00 committed by Michael Natterer
parent b3a8284a3b
commit 6da388be93
4 changed files with 86 additions and 1 deletions

View File

@ -1,3 +1,14 @@
2006-05-11 Michael Natterer <mitch@gimp.org>
Applied modified patch from Michael J. Hammel which allows to
remove all keyboard shortcuts from the menus (fixes bug #331839):
* app/dialogs/preferences-dialog.c: added "Remove all keyboard
shortcuts" button to the "Interface" section.
* app/menus/menus.[ch]: added menus_remove() which does the
shortcut removal.
2006-05-10 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpviewrendererbrush.c

View File

@ -44,6 +44,8 @@
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpgrideditor.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpmessagebox.h"
#include "widgets/gimpmessagedialog.h"
#include "widgets/gimppropwidgets.h"
#include "widgets/gimptemplateeditor.h"
#include "widgets/gimpwidgets-utils.h"
@ -91,6 +93,8 @@ static void prefs_menus_save_callback (GtkWidget *widget,
Gimp *gimp);
static void prefs_menus_clear_callback (GtkWidget *widget,
Gimp *gimp);
static void prefs_menus_remove_callback (GtkWidget *widget,
Gimp *gimp);
static void prefs_session_save_callback (GtkWidget *widget,
Gimp *gimp);
static void prefs_session_clear_callback (GtkWidget *widget,
@ -509,6 +513,45 @@ prefs_menus_clear_callback (GtkWidget *widget,
}
}
static void
prefs_menus_remove_callback (GtkWidget *widget,
Gimp *gimp)
{
GtkWidget *dialog;
dialog = gimp_message_dialog_new (_("Remove all Keyboard Shortcuts"),
GIMP_STOCK_QUESTION,
gtk_widget_get_toplevel (widget),
GTK_DIALOG_MODAL |
GTK_DIALOG_DESTROY_WITH_PARENT,
gimp_standard_help_func, NULL,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_CLEAR, GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
g_signal_connect_object (gtk_widget_get_toplevel (widget), "unmap",
G_CALLBACK (gtk_widget_destroy),
dialog, G_CONNECT_SWAPPED);
gimp_message_box_set_primary_text (GIMP_MESSAGE_DIALOG (dialog)->box,
_("Do you really want to remove all "
"keyboard shortcuts from all menus?"));
if (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK)
{
menus_remove (gimp);
}
gtk_widget_destroy (dialog);
}
static void
prefs_session_save_callback (GtkWidget *widget,
Gimp *gimp)
@ -1451,6 +1494,13 @@ prefs_dialog_new (Gimp *gimp,
g_object_set_data (G_OBJECT (button), "clear-button", button2);
button = prefs_button_add (GTK_STOCK_CLEAR,
_("Remove _All Keyboard Shortcuts"),
GTK_BOX (vbox2));
g_signal_connect (button, "clicked",
G_CALLBACK (prefs_menus_remove_callback),
gimp);
/***********/
/* Theme */

View File

@ -54,7 +54,12 @@
/* local function prototypes */
static void menus_can_change_accels (GimpGuiConfig *config);
static void menus_can_change_accels (GimpGuiConfig *config);
static void menus_remove_accels (gpointer data,
const gchar *accel_path,
guint accel_key,
GdkModifierType accel_mods,
gboolean changed);
/* global variables */
@ -424,6 +429,14 @@ menus_clear (Gimp *gimp,
return success;
}
void
menus_remove (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
gtk_accel_map_foreach (gimp, menus_remove_accels);
}
/* private functions */
@ -434,3 +447,13 @@ menus_can_change_accels (GimpGuiConfig *config)
"gtk-can-change-accels", config->can_change_accels,
NULL);
}
static void
menus_remove_accels (gpointer data,
const gchar *accel_path,
guint accel_key,
GdkModifierType accel_mods,
gboolean changed)
{
gtk_accel_map_change_entry (accel_path, 0, 0, TRUE);
}

View File

@ -33,6 +33,7 @@ void menus_save (Gimp *gimp,
gboolean menus_clear (Gimp *gimp,
GError **error);
void menus_remove (Gimp *gimp);
#endif /* __MENUS_H__ */