Deprecate and ignore gtk-enable-mnemonics and gtk-auto-mnemonics" properties

They are both enabled by default.
This commit is contained in:
William Jon McCann 2013-06-26 11:16:12 -04:00
parent e8147d15f7
commit 7e3a494fac
9 changed files with 28 additions and 83 deletions

View File

@ -483,7 +483,6 @@ static TranslationEntry translations[] = {
{ "org.gnome.desktop.interface", "cursor-blink-timeout", "gtk-cursor-blink-timeout", G_TYPE_INT, { .i = 3600 } },
{ "org.gnome.desktop.interface", "gtk-im-module", "gtk-im-module", G_TYPE_STRING, { .s = "simple" } },
{ "org.gnome.desktop.interface", "enable-animations", "gtk-enable-animations", G_TYPE_BOOLEAN, { .b = TRUE } },
{ "org.gnome.desktop.interface", "automatic-mnemonics", "gtk-auto-mnemonics", G_TYPE_BOOLEAN, { .b = TRUE } },
{ "org.gnome.desktop.interface", "toolbar-style", "gtk-toolbar-style", G_TYPE_STRING, { .s = "both-horiz"} },
{ "org.gnome.desktop.interface", "toolbar-icons-size", "gtk-toolbar-icon-size", G_TYPE_STRING, { .s = "large"} },
{ "org.gnome.settings-daemon.peripherals.mouse", "double-click", "gtk-double-click-time", G_TYPE_INT, { .i = 250 } },

View File

@ -334,7 +334,6 @@ _gdk_win32_window_delete_property (GdkWindow *window,
"Net/FallbackIconTheme\0" "gtk-fallback-icon-theme\0"
"Gtk/TouchscreenMode\0" "gtk-touchscreen-mode\0"
"Gtk/EnableAccels\0" "gtk-enable-accels\0"
"Gtk/EnableMnemonics\0" "gtk-enable-mnemonics\0"
"Gtk/ScrolledWindowPlacement\0" "gtk-scrolled-window-placement\0"
"Gtk/IMModule\0" "gtk-im-module\0"
"Fontconfig/Timestamp\0" "gtk-fontconfig-timestamp\0"

View File

@ -58,7 +58,6 @@ static const struct {
{"Net/FallbackIconTheme", "gtk-fallback-icon-theme"},
{"Gtk/TouchscreenMode", "gtk-touchscreen-mode"},
{"Gtk/EnableAccels", "gtk-enable-accels"},
{"Gtk/EnableMnemonics", "gtk-enable-mnemonics"},
{"Gtk/ScrolledWindowPlacement", "gtk-scrolled-window-placement"},
{"Gtk/IMModule", "gtk-im-module"},
{"Fontconfig/Timestamp", "gtk-fontconfig-timestamp"},
@ -66,7 +65,6 @@ static const struct {
{"Net/EnableInputFeedbackSounds", "gtk-enable-input-feedback-sounds"},
{"Net/EnableEventSounds", "gtk-enable-event-sounds"},
{"Gtk/CursorBlinkTimeout", "gtk-cursor-blink-timeout"},
{"Gtk/AutoMnemonics", "gtk-auto-mnemonics"},
{"Gtk/VisibleFocus", "gtk-visible-focus"},
{"Gtk/ShellShowsAppMenu", "gtk-shell-shows-app-menu"},
{"Gtk/ShellShowsMenubar", "gtk-shell-shows-menubar"},

View File

@ -1867,9 +1867,6 @@ gtk_label_screen_changed (GtkWidget *widget,
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_CALLBACK (label_shortcut_setting_changed),
NULL);
@ -2546,13 +2543,8 @@ gtk_label_set_markup_internal (GtkLabel *label,
if (with_uline)
{
gboolean enable_mnemonics;
gboolean auto_mnemonics;
g_object_get (gtk_widget_get_settings (GTK_WIDGET (label)),
"gtk-enable-mnemonics", &enable_mnemonics,
"gtk-auto-mnemonics", &auto_mnemonics,
NULL);
gboolean enable_mnemonics = TRUE;
gboolean auto_mnemonics = TRUE;
if (!(enable_mnemonics && priv->mnemonics_visible &&
(!auto_mnemonics ||
@ -2760,19 +2752,14 @@ gtk_label_set_pattern_internal (GtkLabel *label,
{
GtkLabelPrivate *priv = label->priv;
PangoAttrList *attrs;
gboolean enable_mnemonics;
gboolean auto_mnemonics;
gboolean enable_mnemonics = TRUE;
gboolean auto_mnemonics = TRUE;
if (priv->pattern_set)
return;
if (is_mnemonic)
{
g_object_get (gtk_widget_get_settings (GTK_WIDGET (label)),
"gtk-enable-mnemonics", &enable_mnemonics,
"gtk-auto-mnemonics", &auto_mnemonics,
NULL);
if (enable_mnemonics && priv->mnemonics_visible && pattern &&
(!auto_mnemonics ||
(gtk_widget_is_sensitive (GTK_WIDGET (label)) &&

View File

@ -1691,26 +1691,18 @@ gtk_main_do_event (GdkEvent *event)
((event->key.state & (gtk_accelerator_get_default_mod_mask ()) & ~(GDK_RELEASE_MASK|GDK_MOD1_MASK)) == 0) &&
!GTK_IS_MENU_SHELL (grab_widget))
{
gboolean auto_mnemonics;
gboolean mnemonics_visible;
GtkWidget *window;
g_object_get (gtk_widget_get_settings (grab_widget),
"gtk-auto-mnemonics", &auto_mnemonics, NULL);
mnemonics_visible = (event->type == GDK_KEY_PRESS);
if (auto_mnemonics)
window = gtk_widget_get_toplevel (grab_widget);
if (GTK_IS_WINDOW (window))
{
gboolean mnemonics_visible;
GtkWidget *window;
mnemonics_visible = (event->type == GDK_KEY_PRESS);
window = gtk_widget_get_toplevel (grab_widget);
if (GTK_IS_WINDOW (window))
{
if (mnemonics_visible)
_gtk_window_schedule_mnemonics_visible (GTK_WINDOW (window));
else
gtk_window_set_mnemonics_visible (GTK_WINDOW (window), FALSE);
}
if (mnemonics_visible)
_gtk_window_schedule_mnemonics_visible (GTK_WINDOW (window));
else
gtk_window_set_mnemonics_visible (GTK_WINDOW (window), FALSE);
}
}
/* else fall through */

View File

@ -945,17 +945,9 @@ void
_gtk_menu_shell_update_mnemonics (GtkMenuShell *menu_shell)
{
GtkMenuShell *target;
gboolean auto_mnemonics;
gboolean found;
gboolean mnemonics_visible;
g_object_get (gtk_widget_get_settings (GTK_WIDGET (menu_shell)),
"gtk-auto-mnemonics", &auto_mnemonics,
NULL);
if (!auto_mnemonics)
return;
target = menu_shell;
found = FALSE;
while (target)
@ -1010,7 +1002,6 @@ gtk_menu_shell_key_press (GtkWidget *widget,
{
GtkMenuShell *menu_shell = GTK_MENU_SHELL (widget);
GtkMenuShellPrivate *priv = menu_shell->priv;
gboolean enable_mnemonics;
priv->keyboard_mode = TRUE;
@ -1021,14 +1012,7 @@ gtk_menu_shell_key_press (GtkWidget *widget,
if (gtk_bindings_activate_event (G_OBJECT (widget), event))
return TRUE;
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;
return gtk_menu_shell_activate_mnemonic (menu_shell, event);
}
static gint

View File

@ -1,5 +1,3 @@
gtk-enable-mnemonics = 0
binding "gtk-mac-alt-arrows"
{
bind "<alt>Right" { "move-cursor" (words, 1, 0) }

View File

@ -943,6 +943,8 @@ gtk_settings_class_init (GtkSettingsClass *class)
* can be activated.
*
* Since: 2.12
*
* Deprecated: 3.10: This setting is ignored
*/
result = settings_install_property_parser (class,
g_param_spec_boolean ("gtk-enable-mnemonics",
@ -1159,12 +1161,14 @@ gtk_settings_class_init (GtkSettingsClass *class)
* presses the mnemonic activator.
*
* Since: 2.20
*
* Deprecated: 3.10: This setting is ignored
*/
result = settings_install_property_parser (class,
g_param_spec_boolean ("gtk-auto-mnemonics",
P_("Auto Mnemonics"),
P_("Whether mnemonics should be automatically shown and hidden when the user presses the mnemonic activator."),
FALSE,
TRUE,
GTK_PARAM_READWRITE),
NULL);
g_assert (result == PROP_AUTO_MNEMONICS);

View File

@ -797,8 +797,7 @@ gtk_window_class_init (GtkWindowClass *klass)
*
* Whether mnemonics are currently visible in this window.
*
* This property is maintained by GTK+ based on the
* #GtkSettings:gtk-auto-mnemonics setting and user input,
* This property is maintained by GTK+ based on user input,
* and should not be set by applications.
*
* Since: 2.20
@ -5367,7 +5366,6 @@ gtk_window_map (GtkWidget *widget)
GtkWindow *window = GTK_WINDOW (widget);
GtkWindowPrivate *priv = window->priv;
GdkWindow *gdk_window;
gboolean auto_mnemonics;
GtkPolicyType visible_focus;
if (!gtk_widget_is_toplevel (widget))
@ -5457,15 +5455,14 @@ gtk_window_map (GtkWidget *widget)
}
}
/* if auto-mnemonics is enabled and mnemonics visible is not already set
/* if mnemonics visible is not already set
* (as in the case of popup menus), then hide mnemonics initially
*/
g_object_get (gtk_widget_get_settings (widget),
"gtk-auto-mnemonics", &auto_mnemonics,
"gtk-visible-focus", &visible_focus,
NULL);
if (auto_mnemonics && !priv->mnemonics_visible_set)
if (!priv->mnemonics_visible_set)
gtk_window_set_mnemonics_visible (window, FALSE);
/* inherit from transient parent, so that a dialog that is
@ -7231,7 +7228,6 @@ gtk_window_focus_in_event (GtkWidget *widget,
GdkEventFocus *event)
{
GtkWindow *window = GTK_WINDOW (widget);
gboolean auto_mnemonics;
/* It appears spurious focus in events can occur when
* the window is hidden. So we'll just check to see if
@ -7243,9 +7239,7 @@ gtk_window_focus_in_event (GtkWidget *widget,
_gtk_window_set_has_toplevel_focus (window, TRUE);
_gtk_window_set_is_active (window, TRUE);
g_object_get (gtk_widget_get_settings (widget),
"gtk-auto-mnemonics", &auto_mnemonics, NULL);
if (auto_mnemonics && gtk_window_has_mnemonic_modifier_pressed (window))
if (gtk_window_has_mnemonic_modifier_pressed (window))
_gtk_window_schedule_mnemonics_visible (window);
}
@ -7257,16 +7251,12 @@ gtk_window_focus_out_event (GtkWidget *widget,
GdkEventFocus *event)
{
GtkWindow *window = GTK_WINDOW (widget);
gboolean auto_mnemonics;
_gtk_window_set_has_toplevel_focus (window, FALSE);
_gtk_window_set_is_active (window, FALSE);
/* set the mnemonic-visible property to false */
g_object_get (gtk_widget_get_settings (widget),
"gtk-auto-mnemonics", &auto_mnemonics, NULL);
if (auto_mnemonics)
gtk_window_set_mnemonics_visible (window, FALSE);
gtk_window_set_mnemonics_visible (window, FALSE);
return FALSE;
}
@ -10724,7 +10714,6 @@ gtk_window_activate_key (GtkWindow *window,
{
GtkKeyHash *key_hash;
GtkWindowKeyEntry *found_entry = NULL;
gboolean enable_mnemonics;
gboolean enable_accels;
g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE);
@ -10742,7 +10731,6 @@ gtk_window_activate_key (GtkWindow *window,
event->group);
g_object_get (gtk_widget_get_settings (GTK_WIDGET (window)),
"gtk-enable-mnemonics", &enable_mnemonics,
"gtk-enable-accels", &enable_accels,
NULL);
@ -10751,11 +10739,8 @@ gtk_window_activate_key (GtkWindow *window,
GtkWindowKeyEntry *entry = tmp_list->data;
if (entry->is_mnemonic)
{
if (enable_mnemonics)
{
found_entry = entry;
break;
}
found_entry = entry;
break;
}
else
{
@ -10773,9 +10758,8 @@ gtk_window_activate_key (GtkWindow *window,
{
if (found_entry->is_mnemonic)
{
if (enable_mnemonics)
return gtk_window_mnemonic_activate (window, found_entry->keyval,
found_entry->modifiers);
return gtk_window_mnemonic_activate (window, found_entry->keyval,
found_entry->modifiers);
}
else
{