Allow applications to use gtk-enable-mnemonics in 3.10

gnome-terminal is still using this setting, so we'll let
applications override it for another cycle. It is no longer
backed by a system-wide setting, though, and it will still
go away eventually.

This partically reverts 7e3a494fac
This commit is contained in:
Matthias Clasen 2013-09-23 13:01:49 -04:00
parent 3312a68a88
commit 34cf40e95c
3 changed files with 23 additions and 3 deletions

View File

@ -1892,6 +1892,9 @@ gtk_label_screen_changed (GtkWidget *widget,
if (! shortcuts_connected) if (! shortcuts_connected)
{ {
g_signal_connect (settings, "notify::gtk-enable-mnemonics",
G_CALLBACK (label_shortcut_setting_changed),
NULL);
g_signal_connect (settings, "notify::gtk-enable-accels", g_signal_connect (settings, "notify::gtk-enable-accels",
G_CALLBACK (label_shortcut_setting_changed), G_CALLBACK (label_shortcut_setting_changed),
NULL); NULL);
@ -2571,6 +2574,10 @@ gtk_label_set_markup_internal (GtkLabel *label,
gboolean enable_mnemonics = TRUE; gboolean enable_mnemonics = TRUE;
gboolean auto_mnemonics = TRUE; gboolean auto_mnemonics = TRUE;
g_object_get (gtk_widget_get_settings (GTK_WIDGET (label)),
"gtk-enable-mnemonics", &enable_mnemonics,
NULL);
if (!(enable_mnemonics && priv->mnemonics_visible && if (!(enable_mnemonics && priv->mnemonics_visible &&
(!auto_mnemonics || (!auto_mnemonics ||
(gtk_widget_is_sensitive (GTK_WIDGET (label)) && (gtk_widget_is_sensitive (GTK_WIDGET (label)) &&
@ -2785,6 +2792,10 @@ gtk_label_set_pattern_internal (GtkLabel *label,
if (is_mnemonic) if (is_mnemonic)
{ {
g_object_get (gtk_widget_get_settings (GTK_WIDGET (label)),
"gtk-enable-mnemonics", &enable_mnemonics,
NULL);
if (enable_mnemonics && priv->mnemonics_visible && pattern && if (enable_mnemonics && priv->mnemonics_visible && pattern &&
(!auto_mnemonics || (!auto_mnemonics ||
(gtk_widget_is_sensitive (GTK_WIDGET (label)) && (gtk_widget_is_sensitive (GTK_WIDGET (label)) &&

View File

@ -968,6 +968,7 @@ gtk_menu_shell_key_press (GtkWidget *widget,
{ {
GtkMenuShell *menu_shell = GTK_MENU_SHELL (widget); GtkMenuShell *menu_shell = GTK_MENU_SHELL (widget);
GtkMenuShellPrivate *priv = menu_shell->priv; GtkMenuShellPrivate *priv = menu_shell->priv;
gboolean enable_mnemonics;
priv->keyboard_mode = TRUE; priv->keyboard_mode = TRUE;
@ -978,7 +979,14 @@ gtk_menu_shell_key_press (GtkWidget *widget,
if (gtk_bindings_activate_event (G_OBJECT (widget), event)) if (gtk_bindings_activate_event (G_OBJECT (widget), event))
return TRUE; return TRUE;
return gtk_menu_shell_activate_mnemonic (menu_shell, event); g_object_get (gtk_widget_get_settings (widget),
"gtk-enable-mnemonics", &enable_mnemonics,
NULL);
if (enable_mnemonics)
return gtk_menu_shell_activate_mnemonic (menu_shell, event);
return FALSE;
} }
static gint static gint

View File

@ -997,14 +997,15 @@ gtk_settings_class_init (GtkSettingsClass *class)
* *
* Since: 2.12 * Since: 2.12
* *
* Deprecated: 3.10: This setting is ignored * Deprecated: 3.10: This setting can still be used for application
* overrides, but will be ignored in the future
*/ */
result = settings_install_property_parser (class, result = settings_install_property_parser (class,
g_param_spec_boolean ("gtk-enable-mnemonics", g_param_spec_boolean ("gtk-enable-mnemonics",
P_("Enable Mnemonics"), P_("Enable Mnemonics"),
P_("Whether labels should have mnemonics"), P_("Whether labels should have mnemonics"),
TRUE, TRUE,
GTK_PARAM_READWRITE | G_PARAM_DEPRECATED), GTK_PARAM_READWRITE),
NULL); NULL);
g_assert (result == PROP_ENABLE_MNEMONICS); g_assert (result == PROP_ENABLE_MNEMONICS);