Commit 54618228 authored by Michael Natterer's avatar Michael Natterer 😴

Bug 689572 - F1 appears remappable but isn't

Make any shortcut involving F1 unchangable in the shortcut editor.
parent a268b7e0
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment