Bug 689572 - F1 appears remappable but isn't

Make any shortcut involving F1 unchangable in the shortcut editor.
This commit is contained in:
Michael Natterer 2012-12-06 01:20:07 +01:00
parent a268b7e03f
commit 54618228e3
1 changed files with 39 additions and 8 deletions

View File

@ -707,7 +707,9 @@ gimp_action_view_conflict_confirm (GimpActionView *view,
static const gchar *
gimp_action_view_get_accel_action (GimpActionView *view,
const gchar *path_string,
GtkAction **action_return)
GtkAction **action_return,
guint *action_accel_key,
GdkModifierType *action_accel_mask)
{
GtkTreeModel *model;
GtkTreePath *path;
@ -724,7 +726,9 @@ gimp_action_view_get_accel_action (GimpActionView *view,
GtkAction *action;
gtk_tree_model_get (model, &iter,
GIMP_ACTION_VIEW_COLUMN_ACTION, &action,
GIMP_ACTION_VIEW_COLUMN_ACTION, &action,
GIMP_ACTION_VIEW_COLUMN_ACCEL_KEY, action_accel_key,
GIMP_ACTION_VIEW_COLUMN_ACCEL_MASK, action_accel_mask,
-1);
if (! action)
@ -752,15 +756,23 @@ gimp_action_view_accel_edited (GtkCellRendererAccel *accel,
guint hardware_keycode,
GimpActionView *view)
{
GtkAction *action;
const gchar *accel_path;
GtkAction *action;
guint action_accel_key;
GdkModifierType action_accel_mask;
const gchar *accel_path;
accel_path = gimp_action_view_get_accel_action (view, path_string,
&action);
&action,
&action_accel_key,
&action_accel_mask);
if (! accel_path)
return;
if (accel_key == action_accel_key &&
accel_mask == action_accel_mask)
return;
if (! accel_key ||
/* Don't allow arrow keys, they are all swallowed by the canvas
@ -777,6 +789,13 @@ gimp_action_view_accel_edited (GtkCellRendererAccel *accel,
G_OBJECT (view), GIMP_MESSAGE_ERROR,
_("Invalid shortcut."));
}
else if (accel_key == GDK_KEY_F1 ||
action_accel_key == GDK_KEY_F1)
{
gimp_message_literal (view->manager->gimp,
G_OBJECT (view), GIMP_MESSAGE_ERROR,
_("F1 cannot be remapped."));
}
else if (! gtk_accel_map_change_entry (accel_path,
accel_key, accel_mask, FALSE))
{
@ -851,15 +870,27 @@ gimp_action_view_accel_cleared (GtkCellRendererAccel *accel,
const char *path_string,
GimpActionView *view)
{
GtkAction *action;
const gchar *accel_path;
GtkAction *action;
guint action_accel_key;
GdkModifierType action_accel_mask;
const gchar *accel_path;
accel_path = gimp_action_view_get_accel_action (view, path_string,
&action);
&action,
&action_accel_key,
&action_accel_mask);
if (! accel_path)
return;
if (action_accel_key == GDK_KEY_F1)
{
gimp_message_literal (view->manager->gimp,
G_OBJECT (view), GIMP_MESSAGE_ERROR,
_("F1 cannot be remapped."));
return;
}
if (! gtk_accel_map_change_entry (accel_path, 0, 0, FALSE))
{
gimp_message_literal (view->manager->gimp,