summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtkmenu.c8
-rw-r--r--gtk/gtkmenuitem.c2
-rw-r--r--gtk/gtkwidget.c5
-rw-r--r--gtk/gtkwidget.h3
4 files changed, 11 insertions, 7 deletions
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index fd9caca9b..493381c7b 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -1817,16 +1817,16 @@ gtk_menu_key_press (GtkWidget *widget,
(delete || gtk_accelerator_valid (event->keyval, event->state)))
{
GtkWidget *menu_item = menu_shell->active_menu_item;
- gboolean replace_accels = TRUE;
+ gboolean locked, replace_accels = TRUE;
const gchar *path;
- path = _gtk_widget_get_accel_path (menu_item);
- if (!path)
+ path = _gtk_widget_get_accel_path (menu_item, &locked);
+ if (!path || locked)
{
/* can't change accelerators on menu_items without paths
* (basically, those items are accelerator-locked).
*/
- /* g_print("item has no path, menu prefix: %s\n", menu->accel_path); */
+ /* g_print("item has no path or is locked, menu prefix: %s\n", menu->accel_path); */
gdk_beep ();
}
else
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
index 93bd035b0..194c92f24 100644
--- a/gtk/gtkmenuitem.c
+++ b/gtk/gtkmenuitem.c
@@ -1082,7 +1082,7 @@ _gtk_menu_item_refresh_accel_path (GtkMenuItem *menu_item,
return;
}
- path = _gtk_widget_get_accel_path (widget);
+ path = _gtk_widget_get_accel_path (widget, NULL);
if (!path) /* no active accel_path yet */
{
path = menu_item->accel_path;
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 16587033d..b416c11c9 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -2828,13 +2828,16 @@ gtk_widget_set_accel_path (GtkWidget *widget,
}
const gchar*
-_gtk_widget_get_accel_path (GtkWidget *widget)
+_gtk_widget_get_accel_path (GtkWidget *widget,
+ gboolean *locked)
{
AccelPath *apath;
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
apath = g_object_get_qdata (G_OBJECT (widget), quark_accel_path);
+ if (locked)
+ *locked = apath ? apath->accel_group->lock_count > 0 : TRUE;
return apath ? g_quark_to_string (apath->path_quark) : NULL;
}
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index 2176e71f0..00c026167 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -496,7 +496,8 @@ gboolean gtk_widget_remove_accelerator (GtkWidget *widget,
void gtk_widget_set_accel_path (GtkWidget *widget,
const gchar *accel_path,
GtkAccelGroup *accel_group);
-const gchar* _gtk_widget_get_accel_path (GtkWidget *widget);
+const gchar* _gtk_widget_get_accel_path (GtkWidget *widget,
+ gboolean *locked);
GList* gtk_widget_list_accel_closures (GtkWidget *widget);
gboolean gtk_widget_mnemonic_activate (GtkWidget *widget,
gboolean group_cycling);